Source: https://mokxi.com/teachers/plans/coding-cpp
Updated: 2026-11-11

Lesson plan

# C++ on a board lesson plan

The language, one idea per lesson, on a board that shows you what your code did.

5 chapters, 13 lessons, about 10 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

- Statements in order, a box with a type, and arithmetic that throws things away.
- One branch runs, a loop walks a list, and a function is written once.
- Where a variable lives, which things belong together, and a header of your own.
- Timing without waiting, a state machine, and a bug found from its evidence.
- The reaction game, and everything on this path, in something you would show somebody.

### Materials for the whole unit

- 74HC595 shift register
- Arduino Uno R3
- Full-size breadboard
- LED x 8
- Pushbutton
- Resistor x 8

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 2 h 20 min

## A program

Statements in order, a box with a type, and arithmetic that throws things away.

Lesson | Time | What students do

A program is a list setup() once, loop() for ever, a statement per line. Run it, read what it says, change one line, and break it on purpose to meet the compiler. | 40 min

- Two functions and a semicolon
- Run it
- loop() runs again
- The order is the program
- Add a line of your own
- Break it on purpose

Variables have a size A box with a name, a type and a value. On this board an int is two bytes, and the sketch shows what happens when a number does not fit. | 50 min

- A box with a name on it
- Print them by name
- Ask the compiler how big
- When a number does not fit
- One variable drives the lamp
- Change the number in one place
- Pick a type for three things

Arithmetic that throws things away Plus, minus, times, divide and the remainder, printed sum by sum. Why 7 / 3 is 2, why parentheses are not decoration, and a lamp that flashes the answer. | 50 min

- Five operators
- Integer division
- The remainder
- Brackets
- The lamp flashes the answer
- Change the sum
- Predict before you run

### Materials

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

### Check for understanding

Each student finishes "Arithmetic that throws things away" on their own, without opening the hints. The simulator checks 7 of its 7 steps as they go.

Then ask each one to explain, in a sentence or two, the last thing it asked of them: "Predict before you run".

Chapter 2. About 2 h 10 min

## Deciding and repeating

One branch runs, a loop walks a list, and a function is written once.

Lesson | Time | What students do

One branch runs if, else if and else pick one of three lamps from a button and the clock. The order of the chain matters, and one = where you meant two is the oldest bug in C. | 50 min

- The chain
- The clock picks a lamp
- And then the other one
- The button wins
- The green lamp
- Add a branch and put it in the wrong place
- One equals sign

A loop over a list Eight patterns in an array, walked by a for loop and shown on eight lamps through a shift register. Where the counting starts, where it stops, and what is past the end. | 40 min

- A list, and a loop that walks it
- How many, from sizeof
- Every pass, printed
- All the way along
- Add a pattern
- Past the end

Write it once A function has a name, parameters and a return type. Three lamps flashed by one function, and two more that answer a question instead of doing a job. | 40 min

- Name, parameters, return type
- Run it
- Parameters are filled in by the caller
- The third lamp
- Change an answer
- A copy is a copy

### Materials

- 74HC595 shift register
- Arduino Uno R3
- Full-size breadboard
- LED x 8
- Pushbutton
- Resistor x 8

### Check for understanding

Each student finishes "Write it once" on their own, without opening the hints. The simulator checks 6 of its 6 steps as they go.

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

Chapter 3. About 2 h 10 min

## Memory and shape

Where a variable lives, which things belong together, and a header of your own.

Lesson | Time | What students do

Where a thing lives A pointer holds an address. The & and * operators, a function that really changes the caller's variable, and why an array is handed over as a pointer. | 50 min

- Two operators
- A function that changes its caller's variable
- A pointer is two bytes here
- An array is an address
- The lamps show the two numbers
- Halve the other one
- The one rule

Things that belong together A struct gives one name to the pieces that make up one thing. Three lamps, each with a pin, a rate, a last time and a state, in one array instead of twelve loose variables. | 40 min

- One name for four things
- Run it
- How big one is
- Three rates, one loop
- Change one number in the list
- Design one

A header of your own Three lamps written out three times. Pull the idea into a Lamp type and two functions in a header file, and the sketch becomes a list and two loops. | 40 min

- Read it and count
- Run it as it is
- Make the header
- Use it
- Change a rate
- What goes in a header

### Materials

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

### Check for understanding

Each student finishes "A header of your own" on their own, without opening the hints. The simulator checks 6 of its 6 steps as they go.

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

Chapter 4. About 2 h 25 min

## Programs that keep working

Timing without waiting, a state machine, and a bug found from its evidence.

Lesson | Time | What students do

Ask the time, do not wait for it Three lamps on three clocks from one loop that never blocks, and a sketch that measures how long its own loop takes. The pattern every real sketch is built on. | 40 min

- delay() is a wall
- Run it
- Three rates at once
- The sketch measures itself
- Put a wall in and watch it
- Two details that are not optional

One variable that says where you are A reaction game as four named states and one variable. An enum, one block per state, and a button that moves the machine on. Nothing blocks and nothing is nested. | 55 min

- Four names and a table
- Ready
- Armed
- Go
- Your time
- The false start
- Name the state in one place
- Draw one

A bug, found from the evidence A score that goes down on the fifth press and a lamp that goes out when it should stay on. Find it from what the board prints, not from staring at the code. | 50 min

- What it is supposed to do
- Run it
- Four presses
- The fifth press
- Name it
- Fix it
- The habit

### Materials

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

### Check for understanding

Each student finishes "A bug, found from the evidence" on their own, without opening the hints. The simulator checks 7 of its 7 steps as they go.

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

Chapter 5. About 40 min

## Make it yours

The reaction game, and everything on this path, in something you would show somebody.

Lesson | Time | What students do

Project: the game is yours The reaction game and everything on this path. Count the rounds, keep the best time, make a false start cost something, then build one of your own. | 40 min

- What you have to work with
- Count the rounds
- Keep the best
- Make a false start cost something
- Pick one and finish it
- What you would reach for next

### Materials

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

### Check for understanding

Each student finishes "Project: the game is yours" on their own, without opening the hints. The simulator checks 6 of its 6 steps as they go.

Then ask each one to explain, in a sentence or two, the last thing it asked of them: "What you would reach for next".

Your class

## Teach this unit as a class

Start a class from this course and its 13 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. 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. Build a vending machine 6 lessons, about 5 h. Every unit All the courses as ready-made units, on the teachers page.
