You will need:
1 x Arduino Uno or compatible board
1 x mini breadboard
5 x male/male wire connectors
1 x 220Ω resistor
1 x 10KΩ resistor
1 x push button
1 x LED
1 x USB cable (to upload code)
1 x 9V battery to barrel jack connector (to power product once uploaded)
For each additional LED you will need:
1 x LED
1 x 220Ω resistor
1 x male/male wire connector
NOTE:
Links to further information about each of these components is provided on the exploringElectronics page.
Button with single LED:
Make up the pictured circuit using the components provided. If your wires are coloured differently, that's OK. Just match up to the diagram where they should connect.
Set the button pin in your Arduino code to 3 and the led pin to 13. Upload and test the code on your board.
The photo below shows what your circuit should look like and the video demonstrates the output expected when using the buttonBasics code (button down turns light on and button released turns it off).
Find the code to operate the LED using a button by selecting File->Examples->Digital->Button as shown in the image below. Make sure you change the LED pin and button pin values in the code to match your circuit.
Button with 2 LEDs:
Modify your circuit using an additional LED, resistor and wire.
Add led pin to 12 to your Arduino code in the required places. Upload and test the code on your board.
Extension:
Add additional lights one at a time. Ensure each LED is placed across 2 rails of the breadboard. The resistor should go from the negative (-ve) leg or cathode of the LED to the -ve rail on the breadboard. The wire goes from the positive (+ve) leg of the LED to the desired pin on the Arduino board. Modify your Arduino code to use the additional LED.
Extension:
Which components in the circuit control the input to this system?
Which components in the circuit display the output from this system?
Use Tinkercad Circuits to draw up a new circuit that would use button input to control text written to the Serial Monitor. No LED lights would be required. Create code to write an integer to the Serial Monitor each time the button is pressed. On the first press write 1, second press 2, etc. Build and test the circuit. Photograph the circuit, screen shot the output and upload evidence to your codeQuest Logs doc.