Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Pins connected to 74HC595
- const int latchPin = 8;
- const int clockPin = 12;
- const int dataPin = 11;
- // Mapping of digits to segments for a common-anode 7-segment display
- const byte digitToSegment[10] = {0xC0, 0xF9, 0xA4, 0xB0, 0x99, 0x92, 0x82, 0xF8, 0x80, 0x90};
- void setup() {
- pinMode(latchPin, OUTPUT);
- pinMode(clockPin, OUTPUT);
- pinMode(dataPin, OUTPUT);
- }
- void loop() {
- for (int i = 0; i < 10; i++) {
- digitalWrite(latchPin, LOW);
- shiftOut(dataPin, clockPin, MSBFIRST, digitToSegment[i]);
- digitalWrite(latchPin, HIGH);
- delay(1000);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement