View difference between Paste ID: cHFLBT3e and Tz7tnQHk
SHOW: | | - or go back to the newest paste.
1
#include <ShiftRegister74HC595.h>
2
3-
//My display matrix connection image: https://imgur.com/a/v81w42t
3+
4
const int rowRegNo=1;
5
const int columnRegNo=2;
6
7
//In my Matrix Display
8
//DataPin  = Blue cable
9
//LatchPin = Green cable
10
//ClockPin = White cable
11
int dpR=2,lpR=3,cpR=4;//Pins of Row
12
int dpC=5,lpC=6,cpC=7;//Pins of Column
13-
int v5=2;
13+
14-
int dpC=2,lpC=3,cpC=4;//Pins of Column
14+
15-
int dpR=5,lpR=6,cpR=7;//Pins of Row
15+
16
ShiftRegister74HC595<rowRegNo> rReg(dpR,cpR,lpR);
17
ShiftRegister74HC595<columnRegNo> cReg(dpC,cpC,lpC);
18
19
int* alphaMt;
20
21
bool mt[rowSize][columnSize] = {
22
  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
23
  {0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0},
24
  {0,1,0,0,1,0,1,0,0,0,0,0,0,0,1,0},
25
  {0,1,0,0,1,0,0,0,1,1,1,1,0,1,1,0},
26
  {0,1,1,1,1,0,1,0,0,0,1,0,0,0,1,0},
27
  {0,1,0,1,0,0,1,0,0,1,0,0,0,0,1,0},
28
  {0,1,0,0,1,0,1,0,1,1,1,1,0,1,1,1},
29
  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
30
};
31
32
void setup() {
33
  initAlpha();
34-
uint8_t mtB[][2]={{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}};
34+
35
36
void loop(){
37-
  Serial.begin(9600);
37+
38-
  pinMode(v5, OUTPUT);
38+
39
40-
  setupBoolDisp();
40+
41
void showDisplay() {
42
  tm++;
43
  if (!(tm%20)) {
44
    pos--;
45
    if(pos<0) pos=15;
46
  }
47
48
  rReg.setAllHigh();//Reverse
49
  cReg.setAllLow();//Reverse
50
  
51
  for (int r=0; r<rowSize; r++){
52
    rReg.set(r, LOW);
53
    for (int c=0; c<columnSize; c++){
54
      int x=(c+pos)%16;
55
      if (mt[r][c]) cReg.set(x, HIGH);
56
    }
57
    cReg.setAllLow();//Reverse
58
    rReg.set(r, HIGH);//Reverse
59
  }
60
}
61
62
void initAlpha(){
63-
      if (mt[r][c]) 
63+
64-
        cReg.setNoUpdate(x,HIGH);//p2
64+
65-
        //cReg.set(x, HIGH);//p1
65+
66