🤖 First Arduino Blink
Write your very first program and make a light blink, just like real engineers do!
🧰 What you need
- 1 Arduino Uno or Uno-compatible board
- 1 USB cable that fits the board
- A computer with the free Arduino IDE (a grown-up should install it)
- Optional: 1 LED, 1 220 Ω resistor, 2 jumper wires, a breadboard
🔧 Let's build it!
- With a grown-up, install the Arduino IDE from the official Arduino website and plug in your board.
- In the IDE, pick your board type (Arduino Uno) and the port it's plugged into.
- Type this program:
void setup() { pinMode(13, OUTPUT); // pin 13 will send power out } void loop() { digitalWrite(13, HIGH); // light ON delay(500); // wait half a second digitalWrite(13, LOW); // light OFF delay(500); // wait again } - Click the Upload arrow. After a moment, the tiny LED marked "L" on the board blinks!
- Change both
delay(500)numbers to 100. Upload again. Super fast blinking! - Bonus: unplug USB, put an LED and a 220 Ω resistor on a breadboard from pin 13 to GND (long LED leg toward pin 13). Plug back in and watch your own LED blink.
- Challenge: can you make it blink S-O-S in Morse code?
🔬 What's happening?
An Arduino is a tiny computer called a microcontroller. Your code tells it to switch pin 13 between HIGH (about 5 volts, ON) and LOW (0 volts, OFF). Inside the chip, transistors (tiny electronic switches) do the switching millions of times faster than you could flip a light switch. setup() runs once when the board starts; loop() repeats forever. The resistor limits the current so your LED doesn't burn out (check the Ohm's law calculator in The Lab!).