Arduino
Blink an LED
“On. Off. On. Off. You just controlled physics with code.”
What you will need
Before you start — get the hardware and software.
Arduino Board
An Arduino Uno or Nano. Available from Amazon, eBay, or any electronics store. Usually around £5-15.
Hardware needed
LED + Resistor
Any colour LED and a 220 ohm resistor. Usually come in starter kits with the Arduino board.
Hardware needed
Arduino IDE
Free software from arduino.cc. Download, install, and open it. Plug your Arduino in via USB.
Free download
What you will have
An LED connected to your Arduino that blinks on and off every second — controlled entirely by code you generated with AI.
Video Walkthrough
Watch the full lesson walkthrough.
Your prompt
Copy this. Paste it into your AI. Hit Enter.
📋 Your Prompt — Copy Everything Below
Write an Arduino sketch that blinks an LED connected to pin 13 on and off every 1 second. Include comments explaining what setup() and loop() do, what pinMode means, and what digitalWrite HIGH and LOW mean. Keep the code simple and beginner friendly.
✅ Copied! Now paste it into your AI.
Wire it up first
Connect your LED before uploading any code.
1
Connect the long leg of the LED to pin 13
Use a jumper wire to connect it to the pin labelled 13 on your Arduino.
2
Connect a 220 ohm resistor to the short leg
Connect the resistor between the short leg and the GND pin on the Arduino.
3
Plug your Arduino into your computer via USB
Go to Tools → Board and select your Arduino model. Go to Tools → Port and select the right port.
Your wiring should look like this — LED long leg to pin 13, short leg through the resistor to GND.
What to do after
Upload the code to your Arduino.
1
Paste the AI code into Arduino IDE
Select all starter code → Delete → paste AI code → Ctrl+V.
2
Click the Upload button
When it says “Done uploading” your code is running.
3
Watch your LED blink
On. Off. On. Off. Every second. That’s your code controlling electricity in the real world.
🛠️ Didn’t work?
Three things to check first:
1 Is the correct Board selected under Tools → Board?
2 Is the correct Port selected under Tools → Port?
3 Copy any error from the IDE and paste to your AI: “This didn’t work. Here’s the error: [paste]. Please fix it.”
Vibe Tweak
Make it blink faster.
Find the number 1000 — that’s the delay in milliseconds. Change it to 200. Upload again.
Find this
delay(1000)
→
Change to this
delay(200)
Extra Credit
Want to go further?
📋 Extra Credit Prompt
Update the Arduino blink sketch to blink an SOS pattern in Morse code on pin 13. Three short blinks, three long blinks, three short blinks. Then pause for 2 seconds and repeat.
✅ Copied!
Reflection
Before you move on — think about this.
“Your code just made something happen in the physical world. Not on a screen — in reality. Can you find the line that turns the LED on?”