Display 4 digits using only 3 MCU wires with the 4 x 7 Segment LED and shift register breakout board.
byte dec_digits[] = {0b11000000,0b11111001,0b10100100,0b10110000,0b10011001,0b10010010,0b10000011,0b11111000,0b10000000,0b10011000 };
Then we have 4 nested for loops for the ones, tens, hundreds, and thousands columns. Each for loop goes to ten which is how many decimal digits we have... Hmmm.. we also have ten fingers, coincidence? No way! Then to display the numbers on the shift registers we use the Arduino shiftOut function.
shiftOut(dataPin, clockPin, MSBFIRST, dec_digits[onesColumn]); shiftOut(dataPin, clockPin, MSBFIRST, dec_digits[tensColumn]); shiftOut(dataPin, clockPin, MSBFIRST, dec_digits[hundredsColumn]); shiftOut(dataPin, clockPin, MSBFIRST, dec_digits[thousandsColumn]);Notice that we send the ones column out first as this is the shift register furthest from the Arduino. We also must make sure to take the shit register's latch pin low before we send out any data and then set it to high again to put the shift registers in output mode so we can see the updated numbers.
| Title | Description | # | Cost | Link | Picture |
| PCB 4x7 Segment LED Breakout | Printed circuit board for our 4 x 7 segment LED shift register breakout board. | 1 | $6.0 | Link |
|
| LED Display | 7 Segment numeric LED Display REDValue:7 Red LEDs | 4 | $0.95 | Link |
|
| Shift Register | IC SHIFT REGISTER 8BIT 16-SOP Tri-State Serial to ParallelValue:74HC | 4 | $0.65 | Link |
|
| Capacitor | CAP CER 0.1UF 50V Y5V 0805Value:0.1µF | 4 | $0.1 | Link |
|
| Resistor Array | RES ARRAY 300 OHM 4 RES 1206Value:300 | 8 | $0.02 | Link |
|
Comments: