One LED is a light. Three LEDs with the right timing is a system, and systems are where engineering begins.
Enter the access code from the card inside your Beginner Kit (or from your GAMERIFT order email).
Don't have a kit yet? Get the Beginner Kit. Lost your code? Contact us.
Somewhere in your town, a box of electronics is doing this exact job right now, and thousands of people trust it with their lives every hour. Today you build that box: green, amber, red, in the right order, with the right timing. Get the order wrong and, as real cities have discovered after software updates gone bad, you get chaos.
Time: 45 minutes · Difficulty: 1/5 · Builds on: Lesson 01
The long blue-striped row down the edge of your breadboard is a rail: every hole in it is connected. Wire the R3's GND pin to the rail once, and all three LEDs can share it. One wire in, three loops out, this is how real circuit boards stay tidy.
Code runs top to bottom, one line at a time, and the order is the behaviour. Green-then-amber-then-red is a safe intersection; red-then-green-then-amber is an accident report. When your program misbehaves, read it in order, line by line, as if you were the chip.
USB unplugged first. Each LED gets the same loop you built in Lesson 01, just on its own pin:
| From | To | Why |
|---|---|---|
| R3 GND | Blue (−) rail | One shared ground for everything |
| Pin 13 | Resistor → red LED long leg | Red's signal wire |
| Pin 12 | Resistor → yellow LED long leg | Amber's signal wire |
| Pin 11 | Resistor → green LED long leg | Green's signal wire |
| Each LED short leg | Blue (−) rail | Three loops, one ground |
Space the LEDs a few rows apart so legs never touch. Stack them red on top, amber middle, green below, like the real thing.
// GAMERIFT Beginner Kit, Lesson 02: Traffic Robot const int red = 13; const int amber = 12; const int green = 11; void setup() { pinMode(red, OUTPUT); pinMode(amber, OUTPUT); pinMode(green, OUTPUT); } void loop() { digitalWrite(green, HIGH); // GO delay(4000); digitalWrite(green, LOW); digitalWrite(amber, HIGH); // get ready to stop… delay(1500); digitalWrite(amber, LOW); digitalWrite(red, HIGH); // STOP delay(4000); digitalWrite(red, LOW); // …and loop() starts over at green }
Upload it. You should see a calm, correct intersection. Watch a full cycle and check: does red ever overlap green? (It shouldn't, and now you know why each colour is switched LOW before the next goes HIGH.)
Film one full cycle of your remix for your mission log. Stuck? Photo of the wiring to the contact form and a human will find the loose leg.
So far your circuit only talks. Next lesson it learns to listen: you wire your first button and build a machine that reacts the moment you press.