Source: https://mokxi.com/learn/path/cpp-real-programs
Updated: 2026-11-11

All paths

# C++ that scales

The habits that keep a big program sane, on the Uno: references and const, classes, a ring buffer, a state machine class, templates, and logic split from pins so it tests itself. Ends with a tested calculator.

Arduino Uno R3 Free 7 lessons 6 h 4 chapters 2,420 XP Coding · Intermediate +150 XP

0 of 7 done

Start the course free References and const Lesson plan for teachers

What you will build

## 3 projects, built step by step

7 lessons in 4 chapters, about 6 hours on a simulated Arduino Uno R3. Free, in your browser, every step checked by the simulator.

Chapter 1 project

### Classes

A Blinker class with private state, a constructor and an invariant it enforces itself: three objects, three lamps, one loop, and a bad value refused.
Open it in the simulator

Chapter 2 project

### A state machine class

The elevator rebuilt as a Lift class: enum class states, one private go() that every transition passes through, and settings that belong to the constructor.
Open it in the simulator

Chapter 3 project

### Testable logic split from pins

A Morse decoder cut in two: logic that takes plain numbers and never touches a pin, so setup() can test it, and a thin pin layer. Find a bug with a test, fix it, move the logic to its own file.
Open it in the simulator

The map

## Chapter by chapter

Each lesson opens when the one before it is done, and each chapter ends in a project.

Chapter 1

## Say what you mean

References, const and classes: who may touch what.

Open 249 XP

### References and const

A copy, a reference and a const reference to one struct: which changes stick, what each one costs, and a swap that only works through references.

0 of 7 steps

Start What is in it

Project Locked 498 XP

### Classes

A Blinker class with private state, a constructor and an invariant it enforces itself: three objects, three lamps, one loop, and a bad value refused.

0 of 7 steps

Chapter 2

## Shapes real firmware has

A ring buffer and a state machine, each as a class.

Locked 249 XP

### A ring buffer

A fixed array that behaves like an endless queue: a head and a tail that wrap, overwrite the oldest when full, and a power-of-two capacity the compiler checks.

0 of 7 steps

Project Locked 436 XP

### A state machine class

The elevator rebuilt as a Lift class: enum class states, one private go() that every transition passes through, and settings that belong to the constructor.

0 of 6 steps

Chapter 3

## Write it once

Templates, and logic cut away from pins so it can test itself.

Locked 236 XP

### Templates

clampTo() for any type, countOf() for any array, and the ring buffer as Ring<T, N>: one piece of source, a checked, fast version for every type you use.

0 of 6 steps

Project Locked 534 XP

### Testable logic split from pins

A Morse decoder cut in two: logic that takes plain numbers and never touches a pin, so setup() can test it, and a thin pin layer. Find a bug with a test, fix it, move the logic to its own file.

0 of 7 steps

Chapter 4

## Project

A keypad calculator built from everything in the course.

Locked 218 XP

### Project: a calculator

The keypad calculator rebuilt from this course: a Calculator class that is pure logic, exact arithmetic in hundredths, a self-test, and a pin layer fed by both the keypad and the serial monitor.

0 of 6 steps

Syllabus

## Every lesson in the course

All 7 lessons, in order, each with what it covers. Any of them opens in the editor right away.

Chapter 1

### Say what you mean

- References and const A copy, a reference and a const reference to one struct: which changes stick, what each one costs, and a swap that only works through references.
- Classes A Blinker class with private state, a constructor and an invariant it enforces itself: three objects, three lamps, one loop, and a bad value refused.

Chapter 2

### Shapes real firmware has

- A ring buffer A fixed array that behaves like an endless queue: a head and a tail that wrap, overwrite the oldest when full, and a power-of-two capacity the compiler checks.
- A state machine class The elevator rebuilt as a Lift class: enum class states, one private go() that every transition passes through, and settings that belong to the constructor.

Chapter 3

### Write it once

- Templates clampTo() for any type, countOf() for any array, and the ring buffer as Ring<T, N>: one piece of source, a checked, fast version for every type you use.
- Testable logic split from pins A Morse decoder cut in two: logic that takes plain numbers and never touches a pin, so setup() can test it, and a thin pin layer. Find a bug with a test, fix it, move the logic to its own file.

Chapter 4

### Project

- Project: a calculator The keypad calculator rebuilt from this course: a Calculator class that is pure logic, exact arithmetic in hundredths, a self-test, and a pin layer fed by both the keypad and the serial monitor.

Keep going

## The next course on your track

C++ that scales is part of the coding track, a ladder of courses from zero to expert.

Next course

### Python with real habits

Advanced Python on a Raspberry Pi, after Python from zero: modules, classes, exceptions, files and logging, tests with plain assert, generators, and a sensor logger that uses them all.
Open the next course

Track

### Coding track

Python and C++ from your first print to classes, tests and state machines. Every program runs on a simulated board, so a bug is something you can see.
See every course on the track

Kits

## Build it on your bench too

Every lesson runs in the simulator with nothing to buy. When you want the real thing, these kits have the parts.

Have a kit already?

### Find your kit

Pick the starter kit you own and run every lesson in its manual with the same parts on the same pins.
See every kit

Questions

## About C++ that scales

Is C++ that scales free?

Yes. All 7 lessons of C++ that scales are free and run in your browser, with nothing to install and no parts to buy before you start.

Do I need a real Arduino Uno R3?

No. Every lesson runs on a simulated Arduino Uno R3 with its parts on the canvas, and the simulator checks each step as you go. When you want to build it for real, the same wiring and code work on a real board.

How long does C++ that scales take?

About 6 hours: 7 lessons in 4 chapters, each one a few short steps. Your progress is kept, so you can stop after any lesson and pick up where you left off.

What will I build?

Each chapter ends in a project that puts it together: Classes, A state machine class and Testable logic split from pins.

Where do I start?

With "References and const", and each lesson builds on the one before it. New to circuits? Electronics basics is the course that starts from zero.
