P423-L2D22
Baru
81 Barang item
Pemberitahuan: Barang terakhir di stok!
Tanggal ketersediaan:
3 Digit seven Segment 0.5 inch Red
3 IC 74hc595 driver
Size PCB : 52x25mm
Library Shift Register Klik
Contoh program
#include <ShiftRegister74HC595.h>
// create shift register object (number of shift registers, data pin, clock pin, latch pin)
ShiftRegister74HC595 sr (3, 7, 6, 5);
const int pot = A0;
int value,digit1,digit2,digit3,digit4;
uint8_t numberB[] = {B11000000, //0
B11111001, //1
B10100100, //2
B10110000, //3
B10011001, //4
B10010010, //5
B10000010, //6
B11111000, //7
B10000000, //8
B10010000 //9
};
void setup() {
//blink();
}
void loop() {
showNumber(666);
delay(2000);//
for(int i=0; i<=999; i++)
{
showNumber(i);
delay(10);
}
delay(2000);
for(int i=999; i >=0; i--)
{
showNumber(i);
delay(10);
}
delay(2000);
}
void showNumber(int num)
{
digit3=num % 10 ;
digit2=(num / 10) % 10 ;
digit1=(num / 100) % 10 ;
//Send them to 7 segment displays
uint8_t numberToPrint[]= {numberB[digit1],numberB[digit2],numberB[digit3]};
sr.setAll(numberToPrint);
}