Code
Code
Code
int x;
int y;
//Columns
int clockPin1 = 2; //Arduino pin connected to Clock Pin 11 of 74HC595
int latchPin1 = 3; //Arduino pin connected to Latch Pin 12 of 74HC595
int dataPin1 = 4; //Arduino pin connected to Data Pin 14 of 74HC595
//Rows
int clockPin2 = 5; //Arduino pin connected to Clock Pin 11 of 74HC595
int latchPin2 = 6; //Arduino pin connected to Latch Pin 12 of 74HC595
int dataPin2 = 7; //Arduino pin connected to Data Pin 14 of 74HC595
//BITMAP
//Bits in this array represents one LED of the matrix
// 8 is # of rows, 6 is # of LED matrices
byte bitmap[8][7];
//FONT DEFENITION
byte alphabets[][8] = {
{0,0,0,0,0},//@ as SPACE
//{8,28,54,99,65},//<<
{31, 36, 68, 36, 31},//A
{127, 73, 73, 73, 54},//B
{62, 65, 65, 65, 34},//C
{127, 65, 65, 34, 28},//D
{127, 73, 73, 65, 65},//E
{127, 72, 72, 72, 64},//F
{62, 65, 65, 69, 38},//G
{127, 8, 8, 8, 127},//H
{0, 65, 127, 65, 0},//I
{2, 1, 1, 1, 126},//J
{127, 8, 20, 34, 65},//K
{127, 1, 1, 1, 1},//L
{127, 32, 16, 32, 127},//M
{127, 32, 16, 8, 127},//N
{62, 65, 65, 65, 62},//O
{127, 72, 72, 72, 48},//P
{62, 65, 69, 66, 61},//Q
{127, 72, 76, 74, 49},//R
{50, 73, 73, 73, 38},//S
{64, 64, 127, 64, 64},//T
{126, 1, 1, 1, 126},//U
{124, 2, 1, 2, 124},//V
{126, 1, 6, 1, 126},//W
{99, 20, 8, 20, 99},//X
{96, 16, 15, 16, 96},//Y
{67, 69, 73, 81, 97},//Z
};
void setup() {
pinMode(latchPin1, OUTPUT);
pinMode(clockPin1, OUTPUT);
pinMode(dataPin1, OUTPUT);
pinMode(latchPin2, OUTPUT);
pinMode(clockPin2, OUTPUT);
pinMode(dataPin2, OUTPUT);
//Clear bitmap
for (int row = 0; row < 8; row++) {
for (int zone = 0; zone <= maxZoneIndex; zone++) {
bitmap[row][zone] = 0;
}
}
}
//FUNCTIONS
// Displays bitmap array in the matrix
void RefreshDisplay()
{
for (int row = 0; row < 8; row++) {
int rowbit = 1 << row;
digitalWrite(latchPin2, LOW);//Hold latchPin LOW for transmitting data
shiftOut(dataPin2, clockPin2, MSBFIRST, rowbit); //Transmit data
//Wait
delayMicroseconds(300);
}
}