预览 · 交付门户中的 Week 1 课程页(建在你 Shopify 上,用站上现有设计)
Techbotics Academy
● Level 1 · Foundations ⏱ 30–40 min Week 1 / 25

Light Your First LED

Wire up your first circuit and write the code that makes a light blink — the “hello world” of electronics.

What you'll learn

  • How to build a simple circuit on a breadboard and connect it to the Arduino
  • What a digital output is, and how the Arduino turns a pin on (HIGH) and off (LOW)
  • Why an LED needs a resistor, and which way it has to face

What you'll build: a single LED on a breadboard that blinks on and off, controlled by code you upload to the Arduino.

1

Components Needed

  • Arduino Uno
  • USB programming cable
  • Breadboard
  • LED  (any colour)
  • 220Ω resistor  colour bands: red–red–brown
  • Male-to-male jumper wires
2

Connections

Build this circuit. Take your time — getting the LED facing the right way is the whole game.

FromTo
Arduino pin 12one end of the 220Ω resistor
other end of the 220Ω resistorthe LED's long leg (the + side, the anode)
the LED's short leg (the − side, the cathode)the breadboard − (GND) rail
Arduino GND pinthe breadboard − (GND) rail
🔎
The one thing that trips everyone up: an LED only works one way round. Long leg = +, short leg = −. If it doesn't light later, this is the first thing to check.
〔 接线图 · Week 1 circuit — 正式版插入套件手册的面包板电路图 〕
3

Tutorial

Build it

Wire the circuit exactly as the table above. Nothing is powered yet — plug the USB cable into the Arduino only after you've checked the LED's long leg goes to the resistor side.

Code it

Open the Arduino IDE, type in this code, and upload it to your board:

week01_blink.ino
// Define which pin the LED is connected to
#define LED_PIN 12

// setup() runs once when the board powers on
void setup() {
  pinMode(LED_PIN, OUTPUT);   // tell pin 12 it's an OUTPUT (it sends power out)
}

// loop() runs over and over, forever
void loop() {
  digitalWrite(LED_PIN, HIGH);  // turn the LED ON  (HIGH = 5 volts out)
  delay(500);                   // wait 500 ms (half a second)
  digitalWrite(LED_PIN, LOW);   // turn the LED OFF (LOW = 0 volts)
  delay(500);                   // wait another half a second
}
Run it

Once it uploads, your LED should blink on for half a second, off for half a second, forever. That's it — you just controlled the physical world with code.

4

Try for Yourself

Now make it yours. Try these before peeking at the answers:

  1. Change the blink speed. Make it blink faster, then slower.
  2. Move the LED to a different pin (like pin 2, 3, or 11) — and update the code to match.
  3. Add a pattern. Make the LED blink three times quickly, then pause for a full second, then repeat.
💡 Answers

1. Change both delay(500) numbers. delay(100) = fast strobe; delay(1000) = slow, calm blink. Smaller number = faster.

2. Rewire the LED to the new pin, then change one line: #define LED_PIN 2 (or whichever pin you used).

3. Replace loop() with a short for loop that blinks 3× fast, then a delay(1000) before it repeats.

5

What Actually Just Happened?

The Arduino has a row of digital pins — little switches it can flip with code. When you wrote digitalWrite(LED_PIN, HIGH), you told pin 12 to push out 5 volts. That voltage pushes a tiny current through the resistor, through the LED, and out to GND — and a glowing LED is just what an LED does when current flows through it the right way. LOW sets the pin back to 0 volts, so no current flows and the light goes out. delay() simply makes the Arduino wait, so instead of switching millions of times a second (too fast to see), you get a visible blink.

🛡️
Why the resistor? An LED on its own would grab too much current and burn itself out in seconds. The 220Ω resistor is a gentle bottleneck that limits the current to a safe amount — think of it as the LED's seatbelt: small, easy to forget, and the reason your part survives.
6

Troubleshooting

The LED never lights up.

Nine times out of ten it's backwards. Check the LED's long leg — it should be on the resistor side (the + side). If the legs are swapped, current can't flow. Pull the LED out, flip it around, and try again.

Still nothing — and the board's own tiny light isn't on either.

The code probably didn't upload. In the Arduino IDE, check Tools → Board is set to Arduino Uno, and Tools → Port is the port that appears when you plug the board in.

It lights up but never turns off, or it's very dim.

Always on? You may have wired the LED straight to 5V instead of pin 12. Very dim? Double-check you used the 220Ω resistor (red–red–brown), not a much larger one.

Still stuck? You're not on your own.Tap “I'm stuck”, snap a photo of your breadboard, and someone who knows this exact project walks you through the fix — within one business day.