i want to be able to attach 2 and have it show a 2 digit variable. need detailed diy please. keep getting links to multi digit 7 segs. i have 2 single digits. so only help with that please.
Your title description is confusing - you mean using individual 7 segment displays.
You "convert" them into a multi digit display by connecting matching segments of each display together, so now you have eight "segment" lines and a common (whether it is cathode or anode) for each digit, then follow the instructions for multiplexing displays of the corresponding common cathode or common anode type.
You have two choices.
- Multiplex them with segments of both displays connected to the same pins.
- Wire each display to a separate pin using a shift register to extend the number of pins you have.
Or, don't multiplex them. Commit 14 pins to drive the 14 segments that make up the 2 seven-segment displays. Connecting each to a shift register is most straightforward way, then need only 3 pins to drive the displays.
Make an array with the mapping needed:
byte fontArray[] = {
0b00111111, // 0
0b00000110, // 1
etc up to 9.
}
bits are DP-g-f-e-d-c-b-a
a
f b
g
e c
d DP
then send the data to the shift registers using SPI (my favorite)
digitalWrite (ssPin, LOW); //
SPI.transfer(fontArray[digit1]);
SPI.transfer(fontArray[digit2]);
digitalWrite (ssPin, HIGH); //
With 74HC595:
D10 is ssPin, connects to RCK
D11 is MOSI, connects to Serial Data In
D13 is SCK, connects to SRCK
SRCLR/ connects to +5
G/ connects to Gnd