Build a button-controlled LED with Arduino Uno — wire, code and test @openhomeautomation
Build a button-controlled LED with Arduino Uno — wire, code and test  @openhomeautomation
Uploaded November 2026 | Updated December 2026, 3 hours ago
Build a button-controlled LED with an Arduino Uno: wire the circuit, understand the sketch, and try press, release and hold in the Serial Monitor.

Parts: Arduino Uno R3, USB data cable, breadboard, LED, a 220-ohm resistor, four-pin push button and four jumper wires. Disconnect USB power while wiring.

Chapters
0:00 What we will build
0:24 Parts and tools
0:53 Wire the LED
1:18 Add the button
1:44 Configure the pins
2:08 Write the loop
2:32 Upload the sketch
2:55 Press, release and hold
3:24 Troubleshooting
3:46 Conclusion

Wiring and upload are illustrated. The sketch logic was tested in software; this is not footage of a physical hardware test. The simple 10 ms delay is not proper switch debouncing. Narration uses an AI-generated voice.

Sketch
const int LED_PIN = 13;
const int BUTTON_PIN = 2;
bool wasPressed = false;

void setup() {
pinMode(LED_PIN, OUTPUT);
pinMode(BUTTON_PIN, INPUT_PULLUP);
Serial.begin(9600);
}

void loop() {
bool pressed = digitalRead(BUTTON_PIN) == LOW;
digitalWrite(LED_PIN, pressed ? HIGH : LOW);
if (pressed != wasPressed) {
Serial.println(pressed ? "pressed: LED on" : "released: LED off");
wasPressed = pressed;
}
delay(10);
}

More projects: makecademy.com
Arduino input pull-up guide: docs.arduino.cc/built-in-examples/digital/InputPullupSerial
Arduino upload help: support.arduino.cc/hc/en-us/articles/4733418441116-Upload-a-sketch-in-Arduino-IDE

#Arduino #Electronics #Makecademy
Build a button-controlled LED with Arduino Uno — wire, code and testCloud Temperature Logger with the ESP8266Open Home System first demoGetting Started with the ESP32Build a WiFi Controlled Robot with the ESP8266MQTT retained messages for ESP32 dashboardsMake a WiFi Weather Station With Arduino and the CC3000 chip
Makecademy |

Build a button-controlled LED with Arduino Uno — wire, code and test

SHARE TO X SHARE TO REDDIT SHARE TO FACEBOOK WALLPAPER