Neon Realm

Day 1: The Call to Adventure – Kai Meets Orion

The neon glow of the city stretches endlessly beyond your hab-pod window. Down in the street maze, autonomous vehicles weave through intersections guided by ancient protocols you're about to master. The traffic management systems that keep Neo-Tokyo flowing were built on principles older than the megacorps themselves.

Your assignment briefing arrives with the familiar blue pulse of your neural interface. The Underground needs someone who understands the rhythm of the city, someone who can decode the patterns that govern movement through the urban jungle. Traffic lights aren't just colored bulbs. They're the nervous system of civilization, pulsing with binary heartbeats that separate order from chaos.

The HERO Board beside you hums to life, its circuits eager to learn the ancient dance of red, yellow, and green. You'll teach it the protocol that keeps millions of citizens moving safely through the neon maze. This isn't just about blinking lights. This is about understanding time, sequence, and the delicate balance between motion and stillness that defines urban survival.

Your fingers hover over the keyboard. Somewhere in the distance, a traffic signal changes from red to green, and a thousand stories continue their journey through the night. Time to write your own story into the code.

What You'll Learn

When you finish this mission, you'll be able to:

Control an LED with your HERO Board using MicroPython, making it blink in perfect rhythm like a traffic signal. You'll understand how to make your microcontroller keep track of time and create repeating patterns that never stop. More importantly, you'll grasp the fundamental concept of program loops and timing control that powers everything from traffic systems to spacecraft navigation.

This isn't just about blinking lights. You're learning the core principles of embedded programming that run the smart city around you.

Understanding the Concept

Think about the last time you waited at a traffic light. Red means stop, green means go, and the timing never changes randomly. There's a precise rhythm to it, a digital heartbeat that keeps the city flowing. Your HERO Board is about to learn that same rhythm.

Every electronic device that blinks, pulses, or changes state on a schedule uses the same basic principle you're about to master. Your smartphone's notification LED, the power indicator on your gaming rig, even the navigation lights on aircraft flying overhead. They all follow the pattern of on, wait, off, wait, repeat forever.

The magic happens in three parts: controlling an output (the LED), managing time (how long to wait), and creating an infinite loop (so it never stops). Your microcontroller excels at all three. It can flip electrical switches millions of times per second, count microseconds with perfect accuracy, and run the same instructions endlessly without getting tired or distracted.

This simple concept scales up to control entire city infrastructures. The same logic that blinks your LED also manages subway systems, regulates building lighting, and coordinates the dance of drones delivering packages across the urban landscape.

Wiring Your Traffic Light

Your LED needs two things: power to make it glow, and a signal to tell it when to turn on or off. The HERO Board provides both through its digital pins.

  1. Connect the LED's long leg (positive/anode) to digital pin 15 on your HERO Board. Pin 15 can output either 3.3 volts (LED on) or 0 volts (LED off) when your program tells it to.
  2. Connect the LED's short leg (negative/cathode) to any GND (ground) pin. This completes the circuit and gives electrons a path back to the power source.
  3. Add a 220-ohm resistor in series with the LED to limit current flow. Without this, your LED would draw too much current and burn out quickly.
Pro Tip

The resistor can go on either the positive or negative side of the LED. Current flows the same either way, so pick whichever makes your wiring cleaner.

Code Walkthrough: Building Your Traffic Light

Time to teach your HERO Board the rhythm of the city. We'll build this program step by step, just like constructing a skyscraper from the foundation up.

Step 1: Import the Essential Libraries

import machine
import time

Every MicroPython program starts by importing the tools it needs. The machine library gives you control over the HERO Board's physical pins, while time lets you create precise delays. Think of these imports as loading the right tools into your digital workshop before starting a project.

Step 2: Configure Your LED Pin

led = machine.Pin(15, machine.Pin.OUT)