Arduino Says Hello
You'll plug a five-dollar board into a USB cable and write your first code that blinks, reads a button and turns a knob into a number.
About
A microcontroller is a circuit that can change its mind. An Arduino Uno clone or a Nano costs a few dollars and runs from any laptop. You'll blink an LED, read a button, and print to the screen, which is the whole loop: input, decide, output. Everything else in this track is more of the same. The first bug is always the USB port rather than your code, so check that first and save yourself an hour.
At a glance
- Per requirement
- 15 XP
- Completion bonus
- 75 XP
- Requirements
- 6
- Takes
- One evening
- Skill level
- Novice (never tried it)
- Cost
- Inexpensive (under $20)
- Supplies
- You need some
- Where
- At home
- Other people
- On your own
Requirements
-
1
Install the Arduino IDE and upload the Blink example to a board. Uno and Nano clones with a CH340 chip may need a driver on some machines, so if the port doesn't show up in the IDE, that's the first thing to check. A charge-only USB cable is the second. Take a photo of the board with its onboard LED lit and the IDE on screen behind it, or film it blinking. Photo or video
-
2
Wire an external LED to a pin with a resistor and change the blink timing. Put 220 to 470 ohms in series, so the pin goes to the resistor, then to the LED's long leg, and the LED's short leg goes to GND. Change the timing so it blinks SOS, three short, three long, three short. Film the pattern. Video
-
3
Read a button on an input pin and light the LED only while it's held. Use INPUT_PULLUP so you don't need an external resistor. The button connects the pin to GND and reads LOW when pressed. Film the button turning the LED on and off, or take a photo of the wiring with the LED lit while your finger is on the button. Photo or video
-
4
Print something useful to the serial monitor once a second. Seconds since boot, the button state or a simple counter all count. Serial.begin(9600) in setup and Serial.println in the loop is all it takes. Take a screenshot of the serial monitor with a few lines scrolled by. Photo
-
5
Read an analog value from a potentiometer and use it to set the blink speed. Wire the pot's outer legs to 5 V and GND and the wiper to A0. analogRead gives you 0 to 1023, so map that to a delay. Film the knob changing the blink rate. Video
-
6
Comment every line of your final sketch so a stranger could follow it. If you can't explain a line, delete it and see what breaks, which is the fastest way to find out what it did. Take a screenshot of the commented sketch. Photo