Wiring up the Circuit#
Referencing the pinout of the Arduino nano in {numref}`
` below, the programmer must first identify where each of the three hardware elements will be connected, ensuring that the pins/ports meet the requirements.
For the push button switch, this will be a digital signal (on/off) so can be connected to any GPIO pin.
Looking at the other hardware requirements, this should avoid the pins connected to the ADC and leave a full port of input pins for the LEDs. For this example, connection
D8
of the nano board is a convenient pin to use, this is connected toPB0
, i.e. Port B bit 0[^note].
For the analogue input, this can be connected to any of the GPIO pins which is also connected to the ADC.
Looking at Fig. 113, these connections are labelled
A0
–A7
on the nano board. ConnectionA0
is connected toPC0
, i.e. Port C bit 0 which is also connected to ADC[0] – ADC channel 0.
The LEDs can be connected to any digital GPIO pin, but ideally will be 8 pins on the same port.
A possible assembly is illustrated in Fig. 114[2]