Traffic-light sequence
Three LEDs switch in a timed order: green, amber, red. It's Blink an LED, repeated with different pins and delays.
Before you start: Blink an LED, Push a button
An independent Arduino learning studio
Explore an Arduino board, experiment with electronic components, and discover how code changes what happens in a circuit. Start in your browser and learn one small step at a time.
How learning works
Guided lessons move through the same seven stages, so each new idea feels familiar. Blink an LED and Push a button are guided today; the other lessons are being upgraded one by one.
Identify the parts and what each one does.
Find the resistor hidden inside the board.
Commit to what you expect before you test it.
Released, does pin 2 read HIGH or LOW?
Change one setting, run, and observe.
Slide the delay to 2000 ms and press Run.
Connect what you saw to the idea behind it.
Pressed button → pin reads LOW → LED on.
Track down a real mistake, with hints if you need them.
Why does the LED flicker by itself?
Use the idea in a new situation.
Make the button latch, like a stop switch.
See what you did, not a score, and what to revisit.
Mark the lesson complete when you are ready.
Interactive Lab
Choose a lesson, change something, and watch the circuit respond.
Lesson 2 of 13
Objective: Use digitalWrite() and delay() to switch an LED on and off at a chosen speed.
Stage 1 of 7 · What am I building?
You are building the classic first circuit: pin 13 switches an LED on and off. Select each part on the circuit, or below, to see what it does. Follow the current: D13 → 220 Ω → LED (+ to −) → GND.
Pick a part. 0/5 inspected.
Before you start (optional refreshers)
Each pin is configured as an input (the program reads it) or an output (the program drives it). pinMode() chooses.
setup() runs once after power-up or reset. loop() then runs again and again, as fast as its statements allow.
New ideas in this lesson
Current only flows around a complete loop: from a supply, through the parts, and back to GND. Break the loop anywhere and everything in it stops.
Voltage pushes, resistance restricts, current is the flow. Ohm's law ties them together: I = V ÷ R.
An LED barely limits its own current. A series resistor sets it: (5 V − about 2 V) ÷ 220 Ω ≈ 14 mA, safe for the LED and the pin.
Some parts only work one way round. An LED's longer leg (anode) goes toward the positive side; reversed, it blocks current and stays dark.
A digital pin is either HIGH (about 5 V on an Uno) or LOW (0 V). digitalWrite() sets an output; digitalRead() reports an input.
delay(ms) pauses the whole program. Nothing else happens while it waits, so a blink lasts ON delay + OFF delay.
Statements run in order, top to bottom. A pattern across several outputs is just writes and delays in the right order.
Describe the symptom, decide whether it points to the code or the wiring, check one thing at a time, then confirm the fix.
You need
Wiring
Before you power up: Always include the resistor. Unplug USB while you change wiring, and check the LED's long leg faces the resistor before you plug back in.
The lab models ideal parts. Real circuits add tolerances, noise and loose wires, so check your wiring against this list before you plug in.
// Blink an LED on pin 13
// (pin 13 → 220 Ω resistor → LED → GND)
const int ledPin = 13;
void setup() {
pinMode(ledPin, OUTPUT);
}
void loop() {
digitalWrite(ledPin, HIGH); // LED on
delay(1000); // stay on for 1000 ms
digitalWrite(ledPin, LOW); // LED off
delay(1000); // stay off for 1000 ms
}Press ▶ Run to step through the sketch line by line, in time with the circuit.
Guided simulations of real circuits. The example code is for reading and copying — nothing is compiled or sent to a board.
Learning Path · 13 lessons
All 13 lessons are interactive. Pick any card to load it in the lab — each one has a guided experiment, a check question and a follow-up challenge.
Building toward robotics? See the pathway for ages 6–17 and the Rescue Rover course →
Component Explorer
Purpose: A light that turns on when current flows through it in the right direction.
Role in a circuit: Output. The longer leg (anode) goes toward the pin, the shorter leg toward GND.
Project Ideas
Three LEDs switch in a timed order: green, amber, red. It's Blink an LED, repeated with different pins and delays.
Before you start: Blink an LED, Push a button
An LED turns on automatically when the room gets dark, using a light sensor and a threshold.
Before you start: Blink an LED, Sense light
An LED lights and a buzzer sounds when an object comes closer than an alert distance you choose, like a simple parking sensor.
Before you start: Read a sensor, Make a sound
A slow indoor rover crosses a marked course without touching cardboard boxes, stops when told, and is tested over five repeatable trials, with a debug record for every fault.
Before you start: Read a sensor, Steer with two motors, Sense, decide, act
FAQs
No. Every activity runs in your browser as a guided demonstration. When you want to build for real, each lesson lists the parts you'd need.
No. Lessons start with what a sketch is and introduce one new instruction at a time, always next to a circuit that shows what it does.
Controls such as the blink delay are code settings, so the example code updates with them. Inputs like the button change what the simulated board reads, while the code that reads them stays the same.
Yes. The lab rearranges for small screens, and the virtual button works with touch.
Yes, in this browser only. Completed lessons and your last selected lesson are stored locally on this device. Clearing browser data or switching devices starts fresh, and you can reset progress any time.
The examples follow standard Arduino functions and can be uploaded with the Arduino IDE. Physical builds need matching hardware and wiring you have checked — the browser activities are simplified demonstrations, not a guarantee your circuit is correct.