Here are the things I used for this lab:
- 2 220-ohm resistors
- 1 10-kilohm resistor
- jumper wires
- a breadboard
- Arduino Nano 33 IoT
- 2 LEDs, one red and one yellow
- a pushbutton
Step 1:
Connect the Arduino with the 10-kilohm resistor and the pushbutton on the breadboard.
Step 2:
Connect the LEDs and the other two resistors on to the breadboard.
Step 3:
Code in Arduino. I followed the tutorial from the lab, and here is what I wrote in Arduino. After saving and checking the sketch, I uploaded to the Arduino microchip.
Step 4:
After uploading the code and plugging in the Arduino, the yellow light lighted up. And when I pressed on the pushbutton, the yellow LED turned off and the red LED turned on, matching the description from the tutorial.
Here is a video recording of the changes when pressing the button.
Some problems I met:
- When I first linked the Arduino chip with my computer, I couldn’t find the port. I tried different ways for trouble shooting, for example changing the USB port to plug in, restarting the program, etc. In the end, it turned out that the wire I was using was not working, and I was able to find the port of my Arduino after I changed another wire.
- When I first connected all the things on the breadboard and enabled Arduino, the yellow light normally, but nothing happened when I pressed the button. So I went through all the wires and connections on the breadboard again, and found that I forgot to connect the power line with the red LED. After I connected it properly, the LEDs and the button worked perfectly.