Your first Arduino blink
Level
Beginner
By admin
1 min read
5 readers
Log in to track your progress.
0 of 3 lessons completed · 0% complete
Turn an LED on and off — the classic embedded “Hello, world!”.
Goal
Blink an LED connected to digital pin 13 (or any free pin with a resistor) every second.
Wiring
TEXT
Arduino pin 13 ──[220 Ω]── LED (+) ── LED (-) ── GND
Sketch
CPP
const int ledPin = 13;
void setup() {
pinMode(ledPin, OUTPUT);
}
void loop() {
digitalWrite(ledPin, HIGH);
delay(1000);
digitalWrite(ledPin, LOW);
delay(1000);
}
Upload the sketch
- Connect the board via USB
- Select the correct board in Tools → Board
- Select the port in Tools → Port
- Click Upload
If upload fails, check the cable and drivers as described in the setup tutorial.
Variant: blink without an external resistor
Some boards have a built-in LED on pin 13. In that case you can skip external components and use the same code.
What you learn
pinMode()configures input/outputdigitalWrite()sets HIGH/LOWdelay()blocks execution (advanced tutorials use non-blocking timers)
Materials
- Arduino Uno (or compatible) × 1
- 5 mm LED × 1
- 220 Ω resistor × 1
- Breadboard and jumper wires × 1 set
Tools
- Arduino IDE 2.x
Comments (0)