5082-73xx
Připojení k Arduinu
Pin 5082-7300 | Název pinu 5082-7300 | Pin Arduino |
---|
1 | INPUT 2 | D3 |
2 | INPUT 4 | D4 |
3 | INPUT 8 | D5 |
4 | DECIMAL POINT | – |
5 | LATCH ENABLE | D7 |
6 | GND | GND |
7 | Vcc | 5V |
8 | INPUT 1 | D2 |
Zdrojový kód pro Arduino
#define INPUT_1 2
#define INPUT_2 3
#define INPUT_4 4
#define INPUT_8 5
#define ENABLE_PIN 7
#define Dp 6
void setup ()
{
pinMode (ENABLE_PIN, OUTPUT);
pinMode (INPUT_1, OUTPUT);
pinMode (INPUT_2, OUTPUT);
pinMode (INPUT_4, OUTPUT);
pinMode (INPUT_8, OUTPUT);
pinMode (Dp, OUTPUT);
}
void loop ()
{
static byte i = 0;
display (i++);
if (i > 15) i = 0;
if (i % 2 == 0) {
digitalWrite (Dp, LOW);
} else {
digitalWrite (Dp, HIGH);
}
delay (300);
}
void display (uint8_t value)
{
digitalWrite (INPUT_1, bitRead (value, 0));
digitalWrite (INPUT_2, bitRead (value, 1));
digitalWrite (INPUT_4, bitRead (value, 2));
digitalWrite (INPUT_8, bitRead (value, 3));
}
Demo video