Skip to content

Welcome to the Arduino_MAX7219_Library wiki!

Kase, Misao edited this page Dec 16, 2018 · 12 revisions

Support method

You can use these methods on this library. You can use "Draw methods" just like Processing code.

Draw methods

  • point(x, y)
  • line(x1, y1, x2, y2)
  • triangle(x1, y1, x2, y2, x3, y3)
  • rect(x, y, w, h)
  • quad(x1, y1, x2, y2, x3, y3, x4, y4)
  • ellipse(x, y, w, h)
  • fill()
    • only support LED status "ON" or "OFF"
  • noFill()

Original methods

  • allOn()
  • allOff()
  • begin()
  • draw()
  • getMemoryUsage()
  • getPoint(x, y)
  • setBrightness({0x00-0x0f})
  • setDrawMode(bool)
  • setDirection({DM_DIRECTION_0, DM_DIRECTION_90, DM_DIRECTION_180, DM_DIRECTION_270})
  • toggle(x, y)

charSet methods

To use these methods, you must include:#include<MAX7219_DotMatrix_charSet.h>

  • printCharDirect(x, y, idx)
  • printCharDirect(idx)
  • setMargine({DM_MARGINE_LEFT, DM_MARGINE_TOP, DM_MARGINE_BOTTOM, DM_MARGINE_RIGHT}, value)
  • printChar(char, x, y)
  • printChar(char)
  • printStr(string, x, y)
  • printStr(string)
  • setCursor(x, y)
  • getCursorX()
  • getCursorY()
  • setScrollStr(string, v, x, y)
  • setScrollStr(string, v)
  • setScrollStr(string)
  • setScrollSpeed(v)
  • addScrollStr(string)
  • scrollStop()
  • setCharDrawMode(bool)
  • setBlink(bool)
  • setBlinkInterval(interval)

Description of how to use the original methods

original methods:

allOn(), allOff()

allOn() and allOff() methods works literally.

begin()

begin() is important method. You MUST call this method in setup().

draw()

draw() method transfer data to MAX7219. In other words, you should call draw() if you want to show anything in Dot Matrix. The reason why I separated the functions in this way is to shorten the transfer time. This library transfers the lighting state of each dot only when draw() is called. Until then, lighting state changed by "Draw method" is stored in the buffer.

getMemoryUsage()

getMemoryUsage() method return memoryusage size[byte]. Return type is uint32_t.

getPoint()

getPoint() method gets LED status of (x, y). Return type is bool. If return value is true the LED is ON, Otherwise OFF. The status of LED is NOT necessarily correct before call draw() because this method just get the LED state buffer value. Unfortunately, since you cannot transfer data from the MAX7219, there is no way to know the actual lighting status of each LEDs

setBrightness()

setBrightness() method set the brightness of LEDs. Initial vlaue = 0x04. If you set low value, the LED brightness will not be stable.

setDrawMode()

setDrawMode() specifies the lighting state of the LED when "Draw methods" are called. Default status of setDrawMode() is true. setDrawMode() needs to be called before calling "Draw methods". For example:

dotMatrix.setDrawMode(DM_ON);
dotMatrix.point(0, 0);
dotMatrix.draw();
// -> point (0, 0) LED will turn ON

dotMatrix.setDrawMode(DM_OFF);
dotMatrix.point(0, 0);
dotMatrix.draw();
// -> point (0, 0) LED will turn OFF

setDirection()

setDirection() method rotate DotMatrix.The argument of this method is:

DM_DIRECTION_0   -> 0   degree(default)
DM_DIRECTION_90  -> 90  degree
DM_DIRECTION_180 -> 180 degree
DM_DIRECTION_270 -> 270 degree

The direction of rotation is clockwise.

toggle()

toggle() method change the LED status of (x, y). If (x, y) LED is on, it will be turn off.