4 Digit Seven Segment Display Module with 74HC595

P423-L2D22

Baru

15 item

Rp. 40.000


4 Digit Seven Segment Display Module with 74HC595

4 Digit seven Segment 0.5 inch Red

4 IC 74hc595 driver

Size PCB : 64x25mm

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 (4, 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(6666);
delay(2000);//
for(int i=0; i<=9999; i++)
{
showNumber(i);
delay(10);
}
delay(2000);
for(int i=99999; i >=0; i--)
{
showNumber(i);
delay(10);
}
delay(2000);
}

void showNumber(int num)
{
digit4=num % 10 ;
digit3=(num / 10) % 10 ;
digit2=(num / 100) % 10 ;
digit1=(num / 1000) % 10 ;
//Send them to 7 segment displays
uint8_t numberToPrint[]= {numberB[digit1],numberB[digit2],numberB[digit3],numberB[digit4]};
sr.setAll(numberToPrint);
}

Blog

Related Products