Blink an LED on pin 9, on an Arduino Uno
An LED and a 220 ohm resistor on pin 9, switched on and off once a second: the first sketch, on a pin you wire yourself. The whole build, an Arduino Uno and 2 more parts, runs here in your browser on the firmware below; open it in the editor to change the wiring or the code and run it again.
Teaching? Assign it to your class in one click.
Beginner Runs in your browser. Free, and no account needed.
The code
The firmware exactly as the editor opens it. Change a line there and press Run: it compiles in the browser.
// Blink an LED on pin 9.
//
// pin 9 -> 220 ohm resistor -> the LED's long leg; the short leg -> GND
//
// digitalWrite(pin, HIGH) puts 5 V on the pin and the LED lights;
// digitalWrite(pin, LOW) takes it back to 0 V and the LED goes out. delay()
// waits a number of milliseconds in between. Change the 500s and run it again.
const int LED_PIN = 9;
void setup() {
pinMode(LED_PIN, OUTPUT);
Serial.begin(9600);
Serial.println("Mokxi Uno: blinking the LED on pin 9");
}
void loop() {
digitalWrite(LED_PIN, HIGH);
delay(500);
digitalWrite(LED_PIN, LOW);
delay(500);
}
Parts list
4 parts, plus the jumper wires. Every one is in the editor's parts bin.
- 1 × Arduino Uno R3
- 1 × Half breadboard
- 1 × Resistor, 220 Ω
- 1 × LED, red
How it is wired
3 connections, pin by pin, read from the circuit itself. Each line is one set of pins joined together, by a jumper wire or a breadboard strip.
- Ground: Arduino Uno R3 pin GND; LED, red pin C
- Arduino Uno R3 pin 9; Resistor, 220 Ω pin 1
- Resistor, 220 Ω pin 2; LED, red pin A
Change it and keep it
Open it in the editor, change the circuit or the code, and keep your version in a free account.