Lab1 Digital Input and Output with an Arduino


Flashing LED

The first lab I make to learn Digital Input starts from making a flashing LED controlled by Arduino. Before starting the lab, I checked the Nano Pinout to understand the positions of Digital Input/Output and Analog Input/Output in Nano.

Untitled

The flashing led lab is mainly to learn about the pinMode and the difference in High and Low state for Digital Output. The first problem I met came up when I'm trying to upload my board to Arduino. At first, I checked my Board under Tools and select Arduino Nano and also checked my Port which I think are all being set to right state. However, Arduino shows that the code can't upload to my board. After checking, I realized that there might be problem with my board and the problem being solved after I installing the Arduino SAMD Boards. When the board is uploaded, I get my first flashing LED. Also, for the delay() reference, I know the time unit is millisecond which helps me know how time is being defined in Arduino.

Screen Shot 2021-09-19 at 3.58.57 PM.png

Screen Shot 2021-09-16 at 8.02.38 PM.png

Screen Shot 2021-09-16 at 8.15.41 PM.png

Screen Shot 2021-09-19 at 4.06.19 PM.png

2021-09-19 20:08:29 +0000.GIF


Button State

After finishing the flashing led lab, I tried to connect my circuit with a button to know how Digital Output work. The first time I add a button to the circuit, the LED doesn't bright. So I decided to start with only button first to test the buttonState. At first, I connect the Voltage to 5V and tried to read the state but I found the buttonState still show as 0 even after I press the button. I double check the pin I connect and finally I find out the problem with the input Voltage. When I change the input voltage from 5V to 3.3V, the button starts to react and show as 0, 1 to indicate on/off.