Making microcontrollers do things (eventually)

Embedded Games 1: Light Chaser

1 Part

A series about building embedded games

Light Chaser Tutorial Series

Learn embedded programming by building an arcade game. In this series, you’ll create a game from scratch. A light races back and forth across a row of LEDs. You press a button to stop it. Hit the target and you score. Miss and the game ends.

No hardware required. Everything runs in simulation using VS Code and Wokwi. Mistakes are free. No waiting for shipping. No burning out components.

You’ll start with a blinking LED and end with a complete game featuring scoring, sound effects, an LCD display, and progressive difficulty. Along the way you’ll learn GPIO, timing, button debouncing, state machines, I2C communication, and how to structure code like a professional.

This series assumes no prior embedded experience. Some programming background helps but isn’t required. Each post builds on the last, explaining not just what to do but why it works.

How the Series is Organised

The first three posts get your tools set up. You’ll install VS Code, PlatformIO, and Wokwi. Then you’ll create your first project and watch an LED blink in simulation. I’ll explain how the circuit definition file works so you’re not just copying configurations you don’t understand.

Posts four through six cover GPIO fundamentals. You’ll learn what GPIO actually means, why unconnected inputs read random values, and how pull up resistors solve that problem. By the end you’ll have a button controlling an LED.

Posts seven through nine teach you the C programming concepts that matter for embedded work. Fixed width integer types, header files, include guards, and why magic numbers cause problems. These posts are shorter but important for everything that follows.

Posts ten and eleven build the Light Chaser circuit. Eight LEDs, a button, proper current calculations, and your first sequential animation. The light will bounce back and forth. But you’ll notice a problem. Button presses get missed.

Posts twelve through fourteen fix the timing. You’ll learn why the delay function breaks interactivity and how to use millis() for non blocking timing. The subtraction pattern you learn here will appear in every embedded project you ever write.

Posts fifteen through seventeen handle button input properly. Level versus edge detection, active low logic, and software debouncing. These concepts confuse everyone at first. I’ll explain them carefully.

Posts eighteen through twenty add game logic. Scoring, visual feedback, randomness, and the complete game loop. You’ll have a playable game by the end of post twenty.

Post twenty one teaches debugging. You’ll learn to set breakpoints, pause execution, and inspect variables. This skill alone is worth the entire series.

Posts twenty two through twenty four refactor your code into clean modules. You’ll separate hardware access from game logic and build a proper abstraction layer. This is how professional embedded software is structured.

Posts twenty five through twenty seven add an LCD display using I2C. You’ll learn just enough about the protocol to use it, plus a scanning technique that helps diagnose address problems.

Posts twenty eight through thirty polish the game. Attract mode, sound effects, difficulty progression, and preparing your code for sharing.

The final two posts cover building the physical version. A shopping list with prices for different regions, tips on sourcing components, and warnings about what behaves differently on real hardware.

Series Contents

  1. 1

    Part 1: Why VS Code + Wokwi for Embedded Learning