Source: https://mokxi.com/teachers/plans/fix-the-bug
Updated: 2026-11-11

Lesson plan

# Fix the bug lesson plan

Short puzzles on an Uno: one planted fault each, in the wiring or the code. Find it, fix it, and see it work.

2 chapters, 8 lessons, about 1 hours, on the Arduino Uno R3. Every lesson runs in the browser, with nothing to install.

Start a class from this course

The unit

## Objectives and materials

### By the end, students can

- A missing wire, a missing ground, and a wire on the wrong pin.
- A copied line, a missing pinMode, an upside-down test, an off-by-one and a stray semicolon.

### Materials for the whole unit

- Arduino Uno R3
- Full-size breadboard
- LED
- Pushbutton
- Resistor

Every part is already on the simulator’s bench, so there is nothing to buy or hand out. The counts are the most any one lesson uses, if you build it on real breadboards too.

Chapter 1. About 30 min

## Wiring faults

A missing wire, a missing ground, and a wire on the wrong pin.

Lesson | Time | What students do

The LED that never lights Blink is running, pin 13 is switching, and the LED on the breadboard stays dark. Find the gap in the loop. | 10 min

- The complaint
- Find it
- Fix it
- What it was

The board with no ground Pin 13 is high, the LED and resistor are wired to the rail, and nothing lights. Find what the loop is missing. | 10 min

- The complaint
- Find it
- Fix it
- What it was

The button on the wrong pin The sketch reads a button on pin 2 and lights the LED. Hold the button and nothing happens. Find out why. | 10 min

- The complaint
- Find it
- Fix it
- What it was

### Materials

- Arduino Uno R3
- Full-size breadboard
- LED
- Pushbutton
- Resistor

### Check for understanding

Each student finishes "The button on the wrong pin" on their own, without opening the hints. The simulator checks 4 of its 4 steps as they go.

Then ask each one to explain, in a sentence or two, the last thing it asked of them: "What it was".

Chapter 2. About 50 min

## Code faults

A copied line, a missing pinMode, an upside-down test, an off-by-one and a stray semicolon.

Lesson | Time | What students do

The blink that stays on A blink sketch with two writes and two delays, and an LED that comes on and never goes off. Read the loop. | 10 min

- The complaint
- Find it
- Fix it
- What it was

The output that is not an output digitalWrite says HIGH and the LED barely glows. The loop is fine. Find what setup() leaves out. | 10 min

- The complaint
- Find it
- Fix it
- What it was

The lamp that is on until you press The LED should light while the button is held. It is lit with the button up and goes dark when you press. | 10 min

- The complaint
- Find it
- Fix it
- What it was

The count that stops at nine A for loop that should print 1 to 10 prints 1 to 9 and says done. Find where ten went. | 10 min

- The complaint
- Find it
- Fix it
- What it was

The if that always runs The LED should light only while the button is held, and it is on all the time. One character is to blame. | 10 min

- The complaint
- Find it
- Fix it
- What it was

### Materials

- Arduino Uno R3
- Full-size breadboard
- LED
- Pushbutton
- Resistor

### Check for understanding

Each student finishes "The if that always runs" on their own, without opening the hints. The simulator checks 4 of its 4 steps as they go.

Then ask each one to explain, in a sentence or two, the last thing it asked of them: "What it was".

Your class

## Teach this unit as a class

Start a class from this course and its 8 lessons are assigned in one go, in order. Students join with a six-character code or printed login cards, and each one’s work comes back to you.

The class tools are free for 30 days for one class of up to 20 students, with no card. The lessons themselves are free either way.

Start a class from this course See the demo class

More units

## Other lesson plans

Electronics basics 20 lessons, about 10 h. Embedded on the Arduino Uno 16 lessons, about 12 h. Embedded on the ESP32-C3 13 lessons, about 11 h. Embedded on the Raspberry Pi Pico 7 lessons, about 6 h. Build your own fight stick 5 lessons, about 4 h. Embedded on the STM32F411 6 lessons, about 6 h. C++ on a board 13 lessons, about 10 h. Digital logic and memory 4 lessons, about 4 h. Interactive devices on the Uno 9 lessons, about 8 h. From gates to a computer 23 lessons, about 16 h. Build a claw machine 8 lessons, about 6 h. Every unit All the courses as ready-made units, on the teachers page.
