The MAX7219 library can be used for a 8x8 LED matrix module or 8x 7-segment module. The library uses the orginal SPI library from the Arduino IDE.
These instructions are for all MCU's.
MCU | MAX7219 (LED Matrix-7Segment) - Modul |
---|---|
VCC | VCC |
GND | GND |
SCK | CLK |
MOSI | DIN |
SS | CS |
To install the library into your IDE:
- click on the Clone or Download button on this Github page and select Download ZIP.
- Start the Arduino IDE and from the Sketch menu do Sketch->Include Library->Add ZIP Library and select the ZIP you just downloaded.
This is a very easy library to use. You may just wish to try out the examples, that send a bitmessage from the MCU to the MAX7219 using the SPI. But for completeness, here it is:
You can use a maximum 8 8x8Matrix fields.
Include the the library.
#include <MAX7219.h>
Initialize the library with an object from Matrix8x8 from the Namespace MAX7219.
MAX7219::Segment myMatrix
Set the brightness of the module.
myMatrix.setIntensity(uint8_t _intensity=1);
_intensity
brightness of segments / from 1 to 15
Writes a byte in the layout
myMatrix.writeByte(uint64_t _byte, int8_t _row=0, int8_t _shift=0, int8_t _invert=0);
_byte
set the value of one byte
_row
set the row from the byte / from 0 to 7
_shift
shift the byte by _shift columns
_invert
inverse the byte / 0=not inverse or 1=inverse
Writes a array in the layout
myMatrix.writeArray(char * _array, int8_t _shift=0, char _inversetion='n', int8_t _invert=0, uint8_t _offset=0);
_array
array[8][8]
_shift
shift the array by _shift columns
_inversetion
Turn the array in the _inversetion direction / n=normal, r=right,l=left,h=headsup
_invert
inverse the array / 0=not inverse or 1=inverse
_offset
change direction / runns 1=right to left or 0=left to right
Write an ASCII-sign in the layout
myMatrix.writeChar(char _char, int8_t _shift=0, char _inversetion='n', int8_t _invert=0, uint8_t _offset=0);
_array
char string
_shift
shift the char by _shift columns
_inversetion
Turn the char in the _inversetion direction / n=normal, r=right,l=left,h=headsup
_invert
inverse the char / 0=not inverse or 1=inverse
_offset
move up by _offset raws
Write a string which runs over the display
myMatrix.printScrollText(char * _text, uint8_t _speed=80, int8_t _invert=0);
_text
char string
_speed
speed auf the running text
_invert
change direction / runs 1=right to left or 0=left to right
Set all 8x8 fields blank.
myMatrix.blankDisplay();
Print/Show the inserted arrays of characters and bytes.
myMatrix.printDisplay();
You can use a maximum of 8 digits (including comma).
Include the the library.
#include <MAX7219.h>
Initialize the library with an object from Segment from the Namespace MAX7219.
MAX7219::Segment mySegment
Set the brightness of the module.
mySegment.setIntensity(uint8_t _intensity=1);
_intensity
brightness of segments / from 1 to 15
Print/Show the number with definded decimals on the segments.
mySegment.printNumber(double _number, uint8_t _decimals=0);
_number
number to show on the segments
_decimals
number of decimal places displayed on the segments
Set all digits blank.
mySegment.blankDisplay();