LED Dot Matrix
A library to draw data onto an 8×8 dot matrix display. [insert pic here]
#include "mbed.h" #include "LEDMatrix.h" #define PI 3.1415926535897 //LEDMatrix Matrix(22,21,20,19,18,17,16,15,30,29,28,27,26,25,24,23); LEDMatrix Matrix(13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28); DigitalOut LED(LED1); //Ticker reload; int smiley[8][8] = { {0,0,0,0,0,0,0,0}, {0,1,1,0,0,1,1,0}, {0,1,1,0,0,1,1,0}, {0,0,0,0,0,0,0,0}, {0,1,0,0,0,0,1,0}, {0,0,1,0,0,1,0,0}, {0,0,0,1,1,0,0,0}, {0,0,0,0,0,0,0,0} }; int blink[8][8] = { {0,0,0,0,0,0,0,0}, {0,1,1,0,0,1,1,0}, {0,0,0,0,0,1,1,0}, {0,0,0,0,0,0,0,0}, {0,1,1,1,1,1,1,0}, {0,0,1,0,0,1,0,0}, {0,0,0,1,1,0,0,0}, {0,0,0,0,0,0,0,0} }; int main() { Matrix.startDraw(); while(1) { Matrix.setData(notok); wait(0.25); Matrix.setData(notok2); wait(0.25); } }
| LEDMatrix | A class to use an 8x8 LED dot matrix display. |
| Functions | |
| LEDMatrix | Create the LEDMatrix class, setting up the rows and cols BusOuts. |
| getPixel | Gets the value of a pixel. |
| setPixel | Sets a pixel on or off. |
| setRow | Sets the value of the pixels on a row. |
| setData | Sets the value of the whole screen. |
| setScanMode | Sets the value of the whole screen. |
| startDraw | Starts redrawing the screen |
| stopDraw | Stops redrawing the screen |
A class to use an 8x8 LED dot matrix display.
class LEDMatrix
Create the LEDMatrix class, setting up the rows and cols BusOuts.
LEDMatrix( int r1, int r2, int r3, int r4, int r5, int r6, int r7, int r8, int c1, int c2, int c3, int c4, int c5, int c6, int c7, int c8, float refresh = 0.0002 )
Gets the value of a pixel.
int getPixel( int x, int y )
Sets a pixel on or off.
void setPixel( int x, int y, int on = 1 )
Sets the value of the pixels on a row.
void setRow( int row, int data[] )
Sets the value of the whole screen.
void setData( int data [][8] )
Sets the value of the whole screen.
void setScanMode( int mode )
Starts redrawing the screen
void startDraw()
Stops redrawing the screen
void stopDraw()
