Chapter 01: Moving In

Bad Wiring Systems (Fixing the Lights)

The emergency lighting system flickers one last time before dying completely. You're standing in the maintenance bay of Pandora Station, surrounded by the skeletal remains of what was once humanity's most advanced research facility. The darkness presses in from all sides, broken only by the pale glow of your headlamp cutting through the stale air.

Your fingers trace the cold metal of a control panel, feeling the intricate network of wires that snake behind it like electronic veins. These corridors haven't seen proper illumination in months, not since the AI uprising turned every connected system into a potential weapon. The irony isn't lost on you: in a world where smart lights became surveillance tools and networked systems turned against their creators, your salvation lies in the most basic of electronics.

A simple LED. A microcontroller. A few lines of code that can't betray you because they're too simple to think. Sometimes the old ways are the only ways that still work. You pull out your HERO Board and a single LED from your salvage kit. Time to bring light back to this dead station, one circuit at a time.

The LED catches the beam of your headlamp, its tiny dome reflecting back a promise of illumination. In the post-AI world, this humble component represents something profound: technology that serves without questioning, lights without watching, functions without plotting. It's honest electronics in a dishonest world.

What You'll Learn

When you finish this lesson, you'll have mastered the fundamentals of digital output control. You'll understand how to configure pins on your HERO Board, control LED states with precision timing, and write clean, well-documented code that any survivor could maintain.

More importantly, you'll understand the deeper principles: how electrical signals translate into physical actions, why proper pin selection matters for complex projects, and how simple patterns can create reliable, predictable behavior in an unpredictable world.

Understanding Digital Output

Think of your HERO Board's digital pins like light switches in your old apartment, except instead of flipping them with your fingers, you control them with code. Each pin can be in one of two states: HIGH (like a switch turned ON, sending 5 volts) or LOW (like a switch turned OFF, sending 0 volts).

An LED is essentially a one-way electrical valve that converts electricity into light. Unlike the incandescent bulbs that used to waste most of their energy as heat, LEDs are efficient little photon factories. They only allow current to flow in one direction (that's why they have positive and negative legs), and they need just the right amount of current to glow without burning out.

The magic happens when you combine digital output control with timing. By rapidly switching an LED on and off with precise delays, you can create patterns, signals, even primitive communication systems. In the old world, this might have been a novelty. In Pandora Station, it could be the difference between signaling for help and staying lost in the dark.

What makes this approach brilliant is its simplicity. No network connections for rogue AIs to exploit. No complex protocols to corrupt. Just basic electrical principles that have worked for over a century, now controlled by a microcontroller programmed to do exactly what you tell it, nothing more.

Wiring Your Emergency Light

LED wiring diagram
  1. Connect the LED's long leg (anode, positive) to pin 22 on your HERO Board. We chose pin 22 because it's a basic digital pin without special functions, leaving other pins free for future components.
  2. Connect the LED's short leg (cathode, negative) to any GND (ground) pin on the board. This completes the electrical circuit.
  3. The HERO Board's pins can safely provide the small current an LED needs, so no external resistor is required for this simple setup.
Pin Selection Strategy

We're using pin 22 because it avoids pins reserved for communication, analog input, PWM, and other specialized functions. This leaves your options open for complex projects later. Think of it as good engineering hygiene for post-apocalyptic electronics.

The Complete Code

Here's the full program that will bring your emergency light to life. Copy this code into your IDE, then we'll break down how each section works together: