#include <ShiftRegister74HC595.h>
//Please change this two value with total Shift Register no in row and column.
const int rowRegNo=1;
const int columnRegNo=2;
//In my Matrix Display
//DataPin = Blue cable
//LatchPin = Green cable
//ClockPin = White cable
int dpR=2,lpR=3,cpR=4;//Pins of Row
int dpC=5,lpC=6,cpC=7;//Pins of Column
const int rowSize=rowRegNo*8;
const int columnSize=columnRegNo*8;
ShiftRegister74HC595<rowRegNo> rReg(dpR,cpR,lpR);
ShiftRegister74HC595<columnRegNo> cReg(dpC,cpC,lpC);
int* alphaMt;
bool mt[rowSize][columnSize] = {
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0},
{0,1,0,0,1,0,1,0,0,0,0,0,0,0,1,0},
{0,1,0,0,1,0,0,0,1,1,1,1,0,1,1,0},
{0,1,1,1,1,0,1,0,0,0,1,0,0,0,1,0},
{0,1,0,1,0,0,1,0,0,1,0,0,0,0,1,0},
{0,1,0,0,1,0,1,0,1,1,1,1,0,1,1,1},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
};
void setup() {
initAlpha();
}
void loop(){
showDisplay();
}
int pos=15,tm=0;
void showDisplay() {
tm++;
if (!(tm%20)) {
pos--;
if(pos<0) pos=15;
}
rReg.setAllHigh();//Reverse
cReg.setAllLow();//Reverse
for (int r=0; r<rowSize; r++){
rReg.set(r, LOW);
for (int c=0; c<columnSize; c++){
int x=(c+pos)%16;
if (mt[r][c]) cReg.set(x, HIGH);
}
cReg.setAllLow();//Reverse
rReg.set(r, HIGH);//Reverse
}
}
void initAlpha(){
int x[rowSize][columnSize]={{0,9}};
//alphaMt = x;
}
Comments