All paths

C++ on a board

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

Arduino Uno R3Free13 lessons10 h5 chapters2,930 XPCoding · Beginner+100 XP

0 of 13 done

What you will build

4 projects, built step by step

13 lessons in 5 chapters, about 10 hours on a simulated Arduino Uno R3. Free, in your browser, every step checked by the simulator.

Chapter 1 project

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.

Open it in the simulator
Chapter 2 project

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.

Open it in the simulator
Chapter 3 project

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.

Open it in the simulator
Chapter 4 project

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.

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

A program

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

  1. Open160 XP

    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.

    0 of 6 steps

  2. Locked185 XP

    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.

    0 of 7 steps

  3. ProjectLocked370 XP

    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.

    0 of 7 steps

5 questions, graded as you go.
Chapter 2

Deciding and repeating

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

  1. Locked185 XP

    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.

    0 of 7 steps

  2. Locked160 XP

    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.

    0 of 6 steps

  3. ProjectLocked320 XP

    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.

    0 of 6 steps

5 questions, graded as you go.
Chapter 3

Memory and shape

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

  1. Locked185 XP

    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.

    0 of 7 steps

  2. Locked160 XP

    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.

    0 of 6 steps

  3. ProjectLocked320 XP

    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.

    0 of 6 steps

5 questions, graded as you go.
Chapter 4

Programs that keep working

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

  1. Locked160 XP

    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.

    0 of 6 steps

  2. Locked210 XP

    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.

    0 of 8 steps

  3. ProjectLocked340 XP

    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.

    0 of 7 steps

4 questions, graded as you go.
Chapter 5

Make it yours

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

  1. Locked175 XP

    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.

    0 of 6 steps

4 questions, graded as you go.
Syllabus

Every lesson in the course

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

Chapter 1

A program

  1. A program is a listsetup() 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.
  2. Variables have a sizeA 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.
  3. Arithmetic that throws things awayPlus, 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.
Chapter 2

Deciding and repeating

  1. One branch runsif, 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.
  2. A loop over a listEight 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.
  3. Write it onceA 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.
Chapter 3

Memory and shape

  1. Where a thing livesA 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.
  2. Things that belong togetherA 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.
  3. A header of your ownThree 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.
Chapter 4

Programs that keep working

  1. Ask the time, do not wait for itThree 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.
  2. One variable that says where you areA 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.
  3. A bug, found from the evidenceA 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.
Chapter 5

Make it yours

  1. Project: the game is yoursThe 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.
Keep going

The next course on your track

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

Next course

Fix the bug

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

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++ on a board

Is C++ on a board free?

Yes. All 13 lessons of C++ on a board 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++ on a board take?

About 10 hours: 13 lessons in 5 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: Arithmetic that throws things away, Write it once, A header of your own and A bug, found from the evidence.

Where do I start?

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