The Schematic Figure 6-15 shows the schematic for two display modules.
RST
AREF
A0
Analog Input
3V3 5V Power
Arduino
V
R8
R10
R11
R12
R13
R14
R15
9 Q7’ GND 8
10 MR Q7
11 SH_CP Q6
R9
7
12 ST_CP Q5 5
6
13 OE Q4
14 DS Q3
4
15
3
16 VCC
Q0 Q2
Q1 1
2
9 Q7’
10 MR Q7
GND 8
7
11 SH_CP Q6
13
12 ST_CP Q5
6
5
14 DS
OE Q4
Q3
Q0 Q2
3
4
15
16 VCC Q1
2
74HC595
D13
1
in
PWM
R7
D12
R6
PWM
PWM
R5
D11
D9
R4
D10
R3
D8
PWM
PWM
PWM
TX
RX
R2
D7
D6
D5
D4
D3
D2
D1
D0 R1
74HC595
A1
A2
A3
A4
A5 GND
Digital Input/Output
R16
Figure 6-15: Schematic for Project 19
Note that the shift registers’ data and clock pins are connected to each other and then to the Arduino. The data line from Arduino digital pin 6 runs to shift register 1, and then a link from pin 9 of shift register 1 runs to pin 14 of shift register 2. To display a number between 0 and 99, we’ll need a more complicated sketch. If a number is less than 10, then we can just send the number followed by a 0, as the right digit displays the number and the left digit displays 0. However, if the number is greater than 10, then we need to determine each of the number’s two digits and send each to the shift registers separately. To make this process easier, we’ll use the math function modulo.
132 Chapter 6