This repository has been archived by the owner on May 11, 2020. It is now read-only.
forked from guyzmo/LeLoopOneLineLedDisplay
-
Notifications
You must be signed in to change notification settings - Fork 0
/
led_matrix_loop.pde
76 lines (65 loc) · 1.82 KB
/
led_matrix_loop.pde
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/* Le Loop Dumped LedMatrix code controller
* this code is adapted to a 1987 led matrix display based on 4094 8bit shifters and darlington arrays
*
*/
// 76x8
#define OE 2 // GRAY OUTPUT ENABLE
#define DATA 4 // PINK DATA
#define STR 6 // ORANGE STROBE
#define CLK 8 // YELLOW CLOCK
#define DELAY 0
class LeLoopMatrix {
private:
int matrix[8][72];
void tick_clock() {
digitalWrite(CLK,LOW);
delay(DELAY);
digitalWrite(CLK,HIGH);
delay(DELAY);
}
public:
void setup() {
pinMode(STR, OUTPUT); // ORANGE (STROBE)
pinMode(CLK, OUTPUT); // YELLOW (CLK)
pinMode(OE, OUTPUT); // GRAY (OUTPUT ENABLE)
pinMode(DATA, OUTPUT); // PINK (DATA)
// default values
digitalWrite(2, HIGH);
digitalWrite(4, LOW);
digitalWrite(6, HIGH);
digitalWrite(8, HIGH);
// reset buffer
reset_matrix();
}
void reset_matrix() {
for (int i=0;i<8;++i)
for (int j=0;j<72;++j)
matrix[i][j] = 0;
}
void set_pixel(int i, int j, int val) {
matrix[i][j] = val;
}
void display() {
for (int i=71;i!=0;--i) {
for (int j=0;j<8;++j) {
if (matrix[j][i]!=0) {
Serial.print("#");
digitalWrite(DATA,HIGH);
tick_clock();
} else {
Serial.print("_");
digitalWrite(DATA,LOW);
tick_clock();
}
}
Serial.println(" ");
}
}
} leloop_matrix;
void setup () {
Serial.begin(19200);
leloop_matrix.setup();
leloop_matrix.display();
}
void loop () {
}