Připojení k Arduinu
Pin SLG 2016 | Název pinu SLG 2016 | Pin Arduino |
---|
1 | Write | D2 |
2 | A1 | D3 |
3 | A0 | D4 |
4 | Vcc | 5V |
5 | D0 | D5 |
6 | D1 | D6 |
7 | D2 | D7 |
8 | D3 | D8 |
9 | D4 | D9 |
10 | D5 | D10 |
11 | D6 | D11 |
12 | Blank | 5V |
13 | Clear | 5V |
14 | GND | GND |
Zdrojový kód pro Arduino
#define SLR2016_A0 4
#define SLR2016_A1 3
#define SLR2016_WR 2
const byte SLR2016_D[] = {5, 6, 7, 8, 9, 10, 11};
char msg[] = " SLR 2016 DEMO ";
void setup() {
for (byte i = 0; i < 7; i++) {
pinMode(SLR2016_D[i], OUTPUT);
}
pinMode(SLR2016_A0, OUTPUT);
pinMode(SLR2016_A1, OUTPUT);
pinMode(SLR2016_WR, OUTPUT);
}
void loop() {
for (byte p = 3; p <= 20; p++) {
for (byte c = 0; c < 7; c++) {
digitalWrite(SLR2016_A0, bitRead(c, 0));
digitalWrite(SLR2016_A1, bitRead(c, 1));
for (byte i = 0; i < 7; i++) {
digitalWrite(SLR2016_D[i], bitRead(msg[p - c], i));
}
if (c < 4) {
digitalWrite(SLR2016_WR, LOW);
digitalWrite(SLR2016_WR, HIGH);
}
}
delay(300);
}
}
Demo video