Připojení k Arduinu
Pin TIL309 | Název pinu TIL309 | Pin Arduino |
---|
1 | QB | D3 |
2 | QC | D4 |
3 | QD | D5 |
4 | QA | D2 |
5 | LS | D8 |
6 | C | – |
7 | D | – |
8 | GND | GND |
9 | NC | – |
10 | B | – |
11 | BI | D7 |
12 | DP | – |
13 | LT | – |
14 | QDP | D6 |
15 | A | – |
16 | Vcc | 5V |
Zdrojový kód pro Arduino
#define LATCH_INPUT_A 2
#define LATCH_INPUT_B 3
#define LATCH_INPUT_C 4
#define LATCH_INPUT_D 5
#define LATCH_INPUT_DP 6
#define BLANK_INPUT 7
#define LATCH_STROBE_PIN 8
void setup ()
{
pinMode (BLANK_INPUT, OUTPUT);
pinMode (LATCH_STROBE_PIN, OUTPUT);
pinMode (LATCH_INPUT_A, OUTPUT);
pinMode (LATCH_INPUT_B, OUTPUT);
pinMode (LATCH_INPUT_C, OUTPUT);
pinMode (LATCH_INPUT_D, OUTPUT);
pinMode (LATCH_INPUT_DP, OUTPUT);
digitalWrite (BLANK_INPUT, HIGH);
digitalWrite (LATCH_STROBE_PIN, LOW);
}
void loop ()
{
static byte i = 0;
display (i++);
if (i > 15) {
digitalWrite(LATCH_INPUT_DP, !digitalRead(LATCH_INPUT_DP));
i = 0;
}
delay (300);
}
void display (uint8_t value)
{
digitalWrite (BLANK_INPUT, LOW);
digitalWrite (LATCH_INPUT_A, bitRead (value, 0));
digitalWrite (LATCH_INPUT_B, bitRead (value, 1));
digitalWrite (LATCH_INPUT_C, bitRead (value, 2));
digitalWrite (LATCH_INPUT_D, bitRead (value, 3));
digitalWrite (BLANK_INPUT, HIGH);
}
Demo video