The zip file here seems to be working with the rows of 8x8 panels.https://www.instructables.com/32x16-LED-Matrix-Panel-and-Arduino/
/*
File : myMATRIX.h
Version : 1.0
Date : 14.01.2015
Project : myMatrix Arduino Library
The MIT License (MIT)
Copyright (c) 2015 Silviu - www.openhardware.ro
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#ifndef myMATRIX_h
#define myMATRIX_h
#include "myMATRIXClass.h"
myMATRIX myMatrix;
#if defined(newTimer2)
ISR(TIMER2_COMPA_vect)
{
myMatrix.Show();
}
#endif
#if defined(oldTimer2)
ISR(TIMER2_COMP_vect)
{
myMatrix.Show();
}
#endif
#endif
/*
File : myMATRIXclass.h
Version : 1.0
Date : 14.01.2015
Project : myMatrix Arduino Library
The MIT License (MIT)
Copyright (c) 2015 Silviu - www.openhardware.ro
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
// ensure this library description is only included once
#ifndef myMATRIXClass_h
#define myMATRIXClass_h
#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) || defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__) \
|| defined(__AVR_ATmega644__) || defined(__AVR_ATmega644A__) || defined(__AVR_ATmega644P__) || defined(__AVR_ATmega644PA__) \
|| defined(__AVR_ATmega328P__) || defined(__AVR_ATmega168P__) || defined(__AVR_ATmega88P__) || defined(__AVR_ATmega48P__)
#define newTimer2
#endif
#if defined(__AVR_ATmega32__) || defined(__AVR_ATmega8__) || defined(__AVR_ATmega64__)
#define oldTimer2
#endif
#include <avr/pgmspace.h>
#if ARDUINO < 100
#include "wiring.h"
#else
#include "Arduino.h"
#endif
#include "font5x7.h"
#define black 0
#define green 1
#define red 2
#define yellow 3
// library interface description
class myMATRIX
{
// user-accessible "public" interface
public:
volatile byte matrixBufferRed[64];
volatile byte matrixBufferGreen[64];
myMATRIX();
void Init(uint8_t pinRed, uint8_t pinGreen, uint8_t pinClock,
uint8_t pinRowA, uint8_t pinRowB, uint8_t pinRowC, uint8_t pinRowD,
uint8_t pinOE, uint8_t pinSTB);
void setPixel(uint8_t x ,uint8_t y, uint8_t color);
void fillRectangle(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint8_t color);
void drawRectangle(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint8_t color);
void clearScreen();
void printChar(uint8_t x,uint8_t y, uint8_t For_color, uint8_t Bk_color, char ch);
void printString(uint8_t x, uint8_t y, uint8_t For_color, uint8_t Bk_color,char *p);
void drawVLine(uint16_t x, uint16_t y1, uint16_t y2, uint8_t color);
void drawHLine(uint16_t x1, uint16_t x2, uint16_t y, uint8_t color);
void hScroll(uint8_t y, uint8_t For_color, uint8_t Bk_color,char *p);
void Show();
// library-accessible "private" interface
private:
byte row;
volatile uint8_t *outRed;
volatile uint8_t *outGreen;
volatile uint8_t *outClock;
volatile uint8_t *outRowA;
volatile uint8_t *outRowB;
volatile uint8_t *outRowC;
volatile uint8_t *outRowD;
volatile uint8_t *outOE;
volatile uint8_t *outSTB;
uint8_t bitRed;
uint8_t bitGreen;
uint8_t bitClock;
uint8_t bitRowA;
uint8_t bitRowB;
uint8_t bitRowC;
uint8_t bitRowD;
uint8_t bitOE;
uint8_t bitSTB;
void t_shiftOut(uint8_t dataRed,uint8_t dataGreen);
void rowScan(byte row);
byte getPixelChar(uint8_t x, uint8_t y1, char ch);
byte getPixelHString(uint16_t x, uint16_t y, char *p);
void timer2Setup(void);
};
unsigned int lenString(char *p);
#endif
/*
File : myMATRIXclass.cpp
Version : 1.0
Date : 14.01.2015
Project : myMatrix Arduino Library
The MIT License (MIT)
Copyright (c) 2015 Silviu - www.openhardware.ro
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#if ARDUINO < 100
#include "WProgram.h" // include core Wiring API
#endif
// include this library's description file
#include "myMATRIXclass.h"
// include description files for other libraries used (if any)
//#include "HardwareSerial.h"
// Constructor /////////////////////////////////////////////////////////////////
// Function that handles the creation and setup of instances
myMATRIX::myMATRIX()
{
}
// Public Methods //////////////////////////////////////////////////////////////
void myMATRIX::Init(uint8_t pinRed, uint8_t pinGreen, uint8_t pinClock,
uint8_t pinRowA, uint8_t pinRowB, uint8_t pinRowC, uint8_t pinRowD,
uint8_t pinOE, uint8_t pinSTB)
{
row = 0;
pinMode(pinRed, OUTPUT);
pinMode(pinGreen, OUTPUT);
pinMode(pinClock, OUTPUT);
pinMode(pinRowA, OUTPUT);
pinMode(pinRowB, OUTPUT);
pinMode(pinRowC, OUTPUT);
pinMode(pinRowD, OUTPUT);
pinMode(pinOE, OUTPUT);
pinMode(pinSTB, OUTPUT);
bitRed = digitalPinToBitMask(pinRed);
uint8_t portRed = digitalPinToPort(pinRed);
outRed = portOutputRegister(portRed);
bitGreen = digitalPinToBitMask(pinGreen);
uint8_t portGreen = digitalPinToPort(pinGreen);
outGreen = portOutputRegister(portGreen);
bitClock = digitalPinToBitMask(pinClock);
uint8_t portClock = digitalPinToPort(pinClock);
outClock = portOutputRegister(portClock);
bitRowA = digitalPinToBitMask(pinRowA);
uint8_t portRowA = digitalPinToPort(pinRowA);
outRowA = portOutputRegister(portRowA);
bitRowB = digitalPinToBitMask(pinRowB);
uint8_t portRowB = digitalPinToPort(pinRowB);
outRowB = portOutputRegister(portRowB);
bitRowC = digitalPinToBitMask(pinRowC);
uint8_t portRowC = digitalPinToPort(pinRowC);
outRowC = portOutputRegister(portRowC);
bitRowD = digitalPinToBitMask(pinRowD);
uint8_t portRowD = digitalPinToPort(pinRowD);
outRowD = portOutputRegister(portRowD);
bitOE = digitalPinToBitMask(pinOE);
uint8_t portOE = digitalPinToPort(pinOE);
outOE = portOutputRegister(portOE);
bitSTB = digitalPinToBitMask(pinSTB);
uint8_t portSTB = digitalPinToPort(pinSTB);
outSTB = portOutputRegister(portSTB);
clearScreen(); // clear buffer
timer2Setup();
}
void myMATRIX::setPixel(uint8_t x ,uint8_t y, uint8_t color) //color 2 Bit, (R)ed (G)reen 0b000000RG
{
uint8_t myindex = (y*4)+x/8;
uint8_t mybitmask = 7 -(x % 8);
if (color & 0b00000010) // red
{
bitWrite(matrixBufferRed[myindex],mybitmask,1);
}
else
{
bitWrite(matrixBufferRed[myindex],mybitmask,0);
}
if (color & 0b00000001) //green
{
bitWrite(matrixBufferGreen[myindex],mybitmask,1);
}
else
{
bitWrite(matrixBufferGreen[myindex],mybitmask,0);
}
}
void myMATRIX::fillRectangle(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint8_t color)
{
for (uint16_t x = x1; x <= x2; x++) {
for (uint16_t y = y1; y <= y2; y++) {
setPixel(x,y,color);
}
}
}
void myMATRIX::drawRectangle(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint8_t color)
{
drawHLine(x1,x2,y1,color);
drawHLine(x1,x2,y2,color);
drawVLine(x1,y1,y2,color);
drawVLine(x2,y1,y2,color);
}
void myMATRIX::drawVLine(uint16_t x, uint16_t y1, uint16_t y2, uint8_t color)
{
for (uint16_t y = y1; y <= y2; y++) {
setPixel(x,y,color);
}
}
void myMATRIX::drawHLine(uint16_t x1, uint16_t x2, uint16_t y, uint8_t color)
{
for (uint16_t x = x1; x <= x2; x++) {
setPixel(x,y,color);
}
}
void myMATRIX::clearScreen()
{
for (uint8_t i=0; i<64; i++)
{
matrixBufferRed[i]=0;
matrixBufferGreen[i]=0;
}
}
void myMATRIX::printChar(uint8_t x,uint8_t y, uint8_t For_color, uint8_t Bk_color, char ch)
{
uint8_t xx,yy;
xx=0;
yy=0;
ch = ch-32;
for (yy=0; yy < 7; yy++)
{
for (xx=0; xx < 5; xx++)
{
if (bitRead(pgm_read_byte(&font5x7[ch][yy]),4-xx)) // 4 == Font witdh -1
{
setPixel(x+xx,y+yy,For_color);
}
else
{
setPixel(x+xx,y+yy,Bk_color);
}
}
}
}
void myMATRIX::printString(uint8_t x, uint8_t y, uint8_t For_color, uint8_t Bk_color,char *p)
{
while(*p!='\0')
{
printChar(x,y,For_color,Bk_color,*p);
x+=6; // 6 = font width + 1 pixel space
p++;
}
}
void myMATRIX::hScroll(uint8_t y, uint8_t For_color, uint8_t Bk_color,char *mystring)
{
int offset =0;
for (offset=0; offset <((lenString(mystring)-5)*6-1); offset++)
{
for (byte xx=0; xx<32; xx++)
{
for (byte yy=0; yy<7; yy++)
{
byte color;
if (getPixelHString(xx+offset,yy,mystring)) color = For_color; else color=Bk_color;
setPixel(xx,yy+y,color);
}
}
delay(50);
}
}
// Private Methods /////////////////////////////////////////////////////////////
void myMATRIX::t_shiftOut(uint8_t dataRed,uint8_t dataGreen)
{
uint8_t i;
uint8_t val;
for (i = 0; i<8; i++)
{
val = !!(dataRed & (1 << (7 - i)));
if (val) *outRed |= bitRed;
else *outRed &= ~bitRed;
val = !!(dataGreen & (1 << (7 - i)));
if (val) *outGreen |= bitGreen;
else *outGreen &= ~bitGreen;
//Clock Pulse
*outClock |= bitClock; //CLK, HIGH
*outClock &= ~bitClock; //CLK, LOW
}
}
void myMATRIX::rowScan(byte row)
{
if (row & 0x01) *outRowA |= bitRowA;
else *outRowA &= ~bitRowA;
if (row & 0x02) *outRowB |= bitRowB;
else *outRowB &= ~bitRowB;
if (row & 0x04) *outRowC |= bitRowC;
else *outRowC &= ~bitRowC;
if (row & 0x08) *outRowD |= bitRowD;
else *outRowD &= ~bitRowD;
}
void myMATRIX::Show()
{
//for (byte row=0; row<16; row++)
//{
byte row4=row*4;
*outOE |= bitOE; //OE HIGH => screen OFF
t_shiftOut(~(matrixBufferRed[row4]),~(matrixBufferGreen[row4]));
t_shiftOut(~(matrixBufferRed[(row4)+1]),~(matrixBufferGreen[(row4)+1]));
t_shiftOut(~(matrixBufferRed[(row4)+2]),~(matrixBufferGreen[(row4)+2]));
t_shiftOut(~(matrixBufferRed[(row4)+3]),~(matrixBufferGreen[(row4)+3]));
rowScan(row);
*outSTB &= ~bitSTB; //STB LOW
*outSTB |= bitSTB; //STB HIGH ... high to copy shift register's data to output
//delayMicroseconds(7); //???;
*outOE &= ~bitOE; //OE LOW => screen ON
//delayMicroseconds(500);
//}
row++;
if (row==16) row=0;
}
byte myMATRIX::getPixelChar(uint8_t x, uint8_t y, char ch)
{
ch = ch-32;
if (x > 4) return 0; // 4 = font Width -1
return bitRead(pgm_read_byte(&font5x7[ch][y]),4-x); // 4 = Font witdh -1
}
byte myMATRIX::getPixelHString(uint16_t x, uint16_t y, char *p)
{
p=p+x/6;
return getPixelChar(x%6,y,*p);
}
void myMATRIX::timer2Setup()
{
#if defined(newTimer2)
TCCR2A = 0;
TCCR2B = 0;
TCNT2 = 0;
OCR2A = 254;
TCCR2A |= (1 << WGM21);
TCCR2B |= (1 << CS22);
TIMSK2 |= (1 << OCIE2A);
#endif
#if defined(oldTimer2)
TCCR2=0;
TCNT2=0;
OCR2 = 254;
TCCR2|= (1 << WGM21);
TCCR2|=(1 << CS22);
TIMSK|=(1<<OCIE2);
TCNT2=0;
#endif
}
// Other Functions //////////////////////////////////////////////////////////////
unsigned int lenString(char *p)
{
unsigned int retVal=0;
while(*p!='\0')
{
retVal++;
p++;
}
return retVal;
}
/*
File : font5x7.h
Version : 1.0
Date : 14.01.2015
Project : myMatrix Arduino Library
The MIT License (MIT)
Copyright (c) 2015 Silviu - www.openhardware.ro
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#ifndef FONT5X7_H
#define FONT5X7_H
//static const uint8_t font5x7[96][7] =
static const uint8_t font5x7[96][7] PROGMEM =
{
{
0B00000, // Space [0]
0B00000,
0B00000,
0B00000,
0B00000,
0B00000,
0B00000},
{
0B00100, // ! [1]
0B00100,
0B00100,
0B00100,
0B00100,
0B00000,
0B00100},
{
0B01010, // " [2]
0B01010,
0B00000,
0B00000,
0B00000,
0B00000,
0B00000},
{
0B00000, // # [3]
0B01010,
0B11111,
0B01010,
0B11111,
0B01010,
0B00000},
{
0B01110, // $ [4]
0B10101,
0B10100,
0B01110,
0B00101,
0B10101,
0B01110},
{
0B11000, // % [5]
0B11001,
0B00010,
0B00100,
0B01000,
0B10011,
0B00011},
{
0B00110, // & [6]
0B01010,
0B00100,
0B01101,
0B10010,
0B10011,
0B01110},
{
0B00100, // ' [7]
0B00100,
0B00000,
0B00000,
0B00000,
0B00000,
0B00000},
{
0B00010, // ( [8]
0B00100,
0B00100,
0B00100,
0B00100,
0B00100,
0B00010},
{
0B01000, // ) [9]
0B00100,
0B00100,
0B00100,
0B00100,
0B00100,
0B01000},
{
0B00100, // * [10]
0B10101,
0B01110,
0B01110,
0B10101,
0B00100,
0B00000},
{
0B00000, // + [11]
0B00100,
0B00100,
0B11111,
0B00100,
0B00100,
0B00000},
{
0B00000, // , [12]
0B00000,
0B00000,
0B00000,
0B00000,
0B00100,
0B00100},
{
0B00000, // - [13]
0B00000,
0B00000,
0B11111,
0B00000,
0B00000,
0B00000},
{
0B00000, // . [14]
0B00000,
0B00000,
0B00000,
0B00000,
0B00000,
0B00100},
{
0B00000, // / [15]
0B00001,
0B00010,
0B00100,
0B01000,
0B10000,
0B00000},
{
0B01110, // 0 [16]
0B10001,
0B10011,
0B10101,
0B11001,
0B10001,
0B01110},
{
0B00100, // 1 [17]
0B01100,
0B10100,
0B00100,
0B00100,
0B00100,
0B11111},
{
0B01110, // 2 [18]
0B10001,
0B00010,
0B00100,
0B01000,
0B10000,
0B11111},
{
0B01110, // 3 [19]
0B10001,
0B00001,
0B00110,
0B00001,
0B10001,
0B01110},
{
0B10010, // 4 [20]
0B10010,
0B10010,
0B11111,
0B00010,
0B00010,
0B00010},
{
0B11111, // 5 [21]
0B10000,
0B10000,
0B11110,
0B00001,
0B00001,
0B11110},
{
0B01110, // 6 [22]
0B10000,
0B10000,
0B11110,
0B10001,
0B10001,
0B01110},
{
0B11111, // 7 [23]
0B00001,
0B00001,
0B00010,
0B00100,
0B00100,
0B00100},
{
0B01110, // 8 [24]
0B10001,
0B10001,
0B01110,
0B10001,
0B10001,
0B01110},
{
0B01110, // 9 [25]
0B10001,
0B10001,
0B01111,
0B00001,
0B10001,
0B01110},
{
0B00000, // : [26]
0B00000,
0B00100,
0B00000,
0B00100,
0B00000,
0B00000},
{
0B00000, // ; [27]
0B00000,
0B00100,
0B00000,
0B00100,
0B01000,
0B00000},
{
0B00011, // < [28]
0B00100,
0B01000,
0B10000,
0B01000,
0B00100,
0B00011},
{
0B00000, // = [29]
0B00000,
0B11111,
0B00000,
0B11111,
0B00000,
0B00000},
{
0B11000, // > [30]
0B00100,
0B00010,
0B00001,
0B00010,
0B00100,
0B11000},
{
0B01110, // ? [31]
0B10001,
0B00001,
0B00110,
0B00100,
0B00000,
0B00100},
{
0B01110, // @ [32]
0B10001,
0B10011,
0B10011,
0B10000,
0B10001,
0B01110},
{
0B01110, // A [33]
0B10001,
0B10001,
0B11111,
0B10001,
0B10001,
0B10001},
{
0B11110, // B [34]
0B10001,
0B10001,
0B11110,
0B10001,
0B10001,
0B11110},
{
0B01110, // C [35]
0B10001,
0B10000,
0B10000,
0B10000,
0B10001,
0B01110},
{
0B11110, // D [36]
0B10001,
0B10001,
0B10001,
0B10001,
0B10001,
0B11110},
{
0B11111, // E [37]
0B10000,
0B10000,
0B11100,
0B10000,
0B10000,
0B11111},
{
0B11111, // F [38]
0B10000,
0B10000,
0B11100,
0B10000,
0B10000,
0B10000},
{
0B01110, // G [39]
0B10001,
0B10000,
0B10000,
0B10011,
0B10001,
0B01110},
{
0B10001, // H [40]
0B10001,
0B10001,
0B11111,
0B10001,
0B10001,
0B10001},
{
0B01110, // I [41]
0B00100,
0B00100,
0B00100,
0B00100,
0B00100,
0B01110},
{
0B00001, // J [42]
0B00001,
0B00001,
0B00001,
0B00001,
0B10001,
0B01110},
{
0B10001, // K [43]
0B10010,
0B10100,
0B11000,
0B10100,
0B10010,
0B10001},
{
0B10000, // L[44]
0B10000,
0B10000,
0B10000,
0B10000,
0B10000,
0B11111},
{
0B10001, // M [45]
0B11011,
0B10101,
0B10001,
0B10001,
0B10001,
0B10001},
{
0B10001, // N [46]
0B10001,
0B11001,
0B10101,
0B10011,
0B10001,
0B10001},
{
0B01110, // O [47]
0B10001,
0B10001,
0B10001,
0B10001,
0B10001,
0B01110},
{
0B11110, // P
0B10001,
0B10001,
0B11110,
0B10000,
0B10000,
0B10000},
{
0B01110, // Q
0B10001,
0B10001,
0B10001,
0B10101,
0B10011,
0B01111},
{
0B11110, // R
0B10001,
0B10001,
0B11110,
0B10100,
0B10010,
0B10001},
{
0B01110, // S
0B10001,
0B10000,
0B01110,
0B00001,
0B10001,
0B01110},
{
0B11111, // T
0B00100,
0B00100,
0B00100,
0B00100,
0B00100,
0B00100},
{
0B10001, // U
0B10001,
0B10001,
0B10001,
0B10001,
0B10001,
0B01110},
{
0B10001, // V
0B10001,
0B10001,
0B10001,
0B10001,
0B01010,
0B00100},
{
0B10001, // W
0B10001,
0B10001,
0B10001,
0B10101,
0B10101,
0B01010},
{
0B10001, // X
0B10001,
0B01010,
0B00100,
0B01010,
0B10001,
0B10001},
{
0B10001, // Y
0B01010,
0B00100,
0B00100,
0B00100,
0B00100,
0B00100},
{
0B11111, // Z
0B00001,
0B00010,
0B00100,
0B01000,
0B10000,
0B11111},
{
0B00110, // [
0B00100,
0B00100,
0B00100,
0B00100,
0B00100,
0B00110},
{
0B00000, // \
0B10000,
0B01000,
0B00100,
0B00010,
0B00001,
0B00000},
{
0B01100, // ]
0B00100,
0B00100,
0B00100,
0B00100,
0B00100,
0B01100},
{
0B00100, // ^
0B01010,
0B10001,
0B00000,
0B00000,
0B00000,
0B00000},
{
0B00000, // _
0B00000,
0B00000,
0B00000,
0B00000,
0B00000,
0B11111},
{
0B00100, // `
0B00100,
0B00000,
0B00000,
0B00000,
0B00000,
0B00000},
{
0B00000, // a
0B00000,
0B11100,
0B00010,
0B01110,
0B10010,
0B11111},
{
0B10000, // b
0B10000,
0B10000,
0B11110,
0B10001,
0B10001,
0B11110},
{
0B00000, // c
0B00000,
0B01110,
0B10001,
0B10000,
0B10001,
0B01110},
{
0B00001, // d
0B00001,
0B00001,
0B01111,
0B10001,
0B10001,
0B01111},
{
0B00000, // e
0B00000,
0B01110,
0B10001,
0B11111,
0B10000,
0B01111},
{
0B01110, // f
0B01001,
0B01000,
0B11100,
0B01000,
0B01000,
0B01000},
{
0B00000, // g
0B00000,
0B01110,
0B10001,
0B11111,
0B00001,
0B01110},
{
0B10000, // h
0B10000,
0B10000,
0B11110,
0B10001,
0B10001,
0B10001},
{
0B00000, // i
0B00100,
0B00000,
0B01100,
0B00100,
0B00100,
0B11111},
{
0B00000, // j
0B00010,
0B00000,
0B00110,
0B00010,
0B00010,
0B11110},
{
0B11000, // k
0B01000,
0B01000,
0B01011,
0B01100,
0B01010,
0B11001},
{
0B01100, // l
0B00100,
0B00100,
0B00100,
0B00100,
0B00100,
0B11111},
{
0B00000, // m
0B00000,
0B10001,
0B11111,
0B10101,
0B10101,
0B10101},
{
0B00000, // n
0B00000,
0B10110,
0B11001,
0B10001,
0B10001,
0B10001},
{
0B00000, // o
0B00000,
0B01110,
0B10001,
0B10001,
0B10001,
0B01110},
{
0B00000, // p
0B00000,
0B11110,
0B10001,
0B11110,
0B10000,
0B10000},
{
0B00000, // q
0B00000,
0B01111,
0B10010,
0B11110,
0B00010,
0B00011},
{
0B00000, // r
0B00000,
0B10110,
0B11001,
0B10000,
0B10000,
0B10000},
{
0B00000, // s
0B00000,
0B01111,
0B10000,
0B11110,
0B00001,
0B11110},
{
0B00100, // t
0B00100,
0B11111,
0B00100,
0B00100,
0B00100,
0B00111},
{
0B00000, // u
0B00000,
0B10001,
0B10001,
0B10001,
0B10001,
0B01111},
{
0B00000, // v
0B00000,
0B10001,
0B10001,
0B10001,
0B01010,
0B00100},
{
0B00000, // w
0B00000,
0B10001,
0B10001,
0B10101,
0B11011,
0B10001},
{
0B00000, // x
0B00000,
0B10001,
0B01010,
0B00100,
0B01010,
0B10001},
{
0B00000, // y
0B00000,
0B10001,
0B10001,
0B01111,
0B00001,
0B00111},
{
0B00000, // z
0B00000,
0B11111,
0B00010,
0B00100,
0B01000,
0B11111},
{
0B00110, // {
0B00100,
0B00100,
0B01000,
0B00100,
0B00100,
0B00110},
{
0B00100, // |
0B00100,
0B00100,
0B00100,
0B00100,
0B00100,
0B00100},
{
0B01100, // }
0B00100,
0B00100,
0B00010,
0B00100,
0B00100,
0B01100},
{
0B00000, // unfinished
0B00000,
0B00000,
0B00000,
0B00000,
0B00000,
0B00000},
{
0B00000, // unfinished
0B00000,
0B00000,
0B00000,
0B00000,
0B00000,
0B00000},
};
#endif
/*
File : myMATRIX_Demo.pde
Version : 1.0
Date : 14.01.2015
Project : myMatrix Arduino Library
The MIT License (MIT)
Copyright (c) 2015 Silviu - www.openhardware.ro
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
/*
Simple demo for <myMatrix> 16x32 Red Green LED Matrix Panel .
The circuit:
A connect to digital pin 2
B connect to digital pin 3
C connect to digital pin 4
D connect to digital pin 5
OE connect to digital pin 6
R connect to digital pin 7
G connect to digital pin 8
CLK connect to digital pin 9
STB connect to digital pin 10
GND connect to GND
*/
#include "myMATRIX.h"
#define RowA_Pin 2
#define RowB_Pin 3
#define RowC_Pin 4
#define RowD_Pin 5
#define OE_Pin 6
#define Red_Pin 7
#define Green_Pin 8
#define CLK_Pin 9
#define STB_Pin 10
void setup ()
{
myMatrix.Init(Red_Pin,Green_Pin,CLK_Pin,RowA_Pin,RowB_Pin,RowC_Pin,RowD_Pin,OE_Pin,STB_Pin);
}
void loop()
{
myMatrix.clearScreen();
char scrolltext_1[]=" * www.OpenHardware.Ro * ";
char scrolltext_2[]=" * Numbers * 1234567890 ";
char scrolltext_3[]=" * Capital Letters * ABCDEFGHIJKLMNOPQRSTUVXYZ ";
char scrolltext_4[]=" * Small Letters * abcdefghijklmnopqrstuvxyz ";
myMatrix.fillRectangle(0,0,31,15,red);
delay(1000);
myMatrix.fillRectangle(0,0,31,15,green);
delay(1000);
myMatrix.fillRectangle(0,0,31,15,yellow);
delay(1000);
myMatrix.drawRectangle(0,0,31,15,red);
delay(1000);
myMatrix.fillRectangle(10,3,21,12,green);
delay(1000);
myMatrix.clearScreen();
myMatrix.drawHLine(0,31,7,green);
myMatrix.drawHLine(0,31,15,green);
myMatrix.drawVLine(0,0,15,yellow);
myMatrix.drawVLine(31,0,15,yellow);
myMatrix.printString(5,8,yellow,black,"Demo");
myMatrix.hScroll(0,red,black,scrolltext_1);
myMatrix.hScroll(0,black,green,scrolltext_1);
myMatrix.hScroll(0,red,black,scrolltext_2);
myMatrix.hScroll(0,red,black,scrolltext_3);
myMatrix.hScroll(0,red,black,scrolltext_4);
}