Source: https://mokxi.com/learn/cpp-for-embedded
Updated: 2026-11-11

Coding track
C++ for embedded

# Learn C++ for embedded systems, on a board

Types with a size, pointers and structs first, then references, classes, ring buffers, templates and code you can test without the hardware.

Free In your browser 2 courses, 20 lessons, about 16 hours

Start free Variables have a size See the course

Overview

## How you will learn it

Embedded C++ is C++ with a budget: a few kilobytes of memory, no operating system and a board that does exactly what the code says. Learning it on a simulated Arduino means every idea shows up as something the board does.

C++ on a board teaches the language one idea per lesson. C++ that scales adds the habits that keep a big firmware sane: const references, classes, a ring buffer, a state machine class, templates and logic split from the pins so you can test it.

Outcomes

## What you will learn

- Choose types by size and know where integer math throws things away.
- Use pointers, structs and your own header files.
- Write classes, ring buffers and state machines for firmware.
- Split logic from hardware so it can be tested on its own.

Your route

## The courses and lessons to take

Every lesson opens in the editor right away, signed in or not, and the simulator checks each step.

- Step 1 · 13 lessons · 10 h

### C++ on a board

The language, one idea per lesson.

- 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.
- 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.
- 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.
- 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.
Every lesson in the course
- Step 2 · 7 lessons · 6 h

### C++ that scales

The habits real firmware needs.

- 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.
- 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.
- 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.
Every lesson in the course

Keep going

## Guides and tools on the same subject

Guide

### Arduino state machine

Open it

Guide

### Arduino static variable vs global

Open it

Tool

### Online Arduino compiler

Open it

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 the whole track

Questions

## Questions people ask

Is Arduino code real C++?

Yes. A sketch is C++ compiled by the same compiler embedded professionals use, with a few helper functions on top.

C or C++ for embedded?

Both are used. C++ adds classes, references and templates that make bigger firmware easier to organize, and it can do everything C does.

Do I need to know C first?

No. C++ on a board starts from a program that is a list of steps and builds up.
