Source: https://mokxi.com/learn/path/binary-hex-and-bits
Updated: 2026-11-20

All paths

# Binary, hex and bits

What a number really is, one bit a lamp: counting in binary, hex, AND OR XOR, shifts and masks, signed numbers and the lies floats tell. Ends with a binary clock you learn to read.

Arduino Uno R3 Free 7 lessons 5 h 4 chapters 1,910 XP Coding · Beginner +100 XP

0 of 7 done

Start the course free Counting in binary Lesson plan for teachers

What you will build

## 3 projects, built step by step

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

Chapter 1 project

### Hex shorthand

One hex digit is exactly four bits: the sixteen digits, printing with %X, a hex parser written by hand that lights what you type, and making it take lower case too.
Open it in the simulator

Chapter 2 project

### Shifts and masks

Shifting left and right to multiply and divide by two, the four one-bit moves every firmware engineer knows (set, clear, toggle, test), pulling a field out of a number, and a scanner eye.
Open it in the simulator

Chapter 3 project

### Floats and their lies

A float is 32 bits of sign, exponent and fraction: ten dimes that miss a dollar by one bit, the bits of 1.0, a number too big to add one to, the knob as a float on the lamps, and comparing with a tolerance.
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

## Base two

Count in binary on ten lamps, then write it short in hex.

Open 190 XP

### Counting in binary

Ten lamps, ten bits: a counter you can watch, what each lamp is worth, reading a binary number by hand, the biggest number ten bits hold, rolling over, and the knob as a 10-bit number.

0 of 6 steps

Start What is in it

Project Locked 380 XP

### Hex shorthand

One hex digit is exactly four bits: the sixteen digits, printing with %X, a hex parser written by hand that lights what you type, and making it take lower case too.

0 of 6 steps

4 questions, graded as you go.

Chapter 2

## Bit tricks

AND, OR and XOR, then shifts and masks.

Locked 190 XP

### AND OR XOR

Logic on every bit at once: AND keeps the bits a mask allows, OR forces bits on, XOR flips them, all tried on the knob, plus the XOR trick behind a cipher.

0 of 6 steps

Project Locked 380 XP

### Shifts and masks

Shifting left and right to multiply and divide by two, the four one-bit moves every firmware engineer knows (set, clear, toggle, test), pulling a field out of a number, and a scanner eye.

0 of 6 steps

4 questions, graded as you go.

Chapter 3

## When bits mean numbers

Two's complement, then the float format and its lies.

Locked 190 XP

### Signed numbers

How eight bits hold -128 to 127: two's complement, flip and add one, the edges of an int8_t, one byte read two ways from the knob, and a submarine dive that does not fit.

0 of 6 steps

Project Locked 380 XP

### Floats and their lies

A float is 32 bits of sign, exponent and fraction: ten dimes that miss a dollar by one bit, the bits of 1.0, a number too big to add one to, the knob as a float on the lamps, and comparing with a tolerance.

0 of 6 steps

5 questions, graded as you go.

Chapter 4

## Project

A binary clock packed into ten lamps, and a quiz to read it.

Locked 200 XP

### Project: a binary clock reader

Everything in one build: hours in four bits and minutes in six, packed into ten lamps with a shift and an OR, read back with a mask, a mask bug to find and fix, and a quiz that trains you to read the lamps. Then make it yours.

0 of 7 steps

4 questions, graded as you go.

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

### Base two

- Counting in binary Ten lamps, ten bits: a counter you can watch, what each lamp is worth, reading a binary number by hand, the biggest number ten bits hold, rolling over, and the knob as a 10-bit number.
- Hex shorthand One hex digit is exactly four bits: the sixteen digits, printing with %X, a hex parser written by hand that lights what you type, and making it take lower case too.

Chapter 2

### Bit tricks

- AND OR XOR Logic on every bit at once: AND keeps the bits a mask allows, OR forces bits on, XOR flips them, all tried on the knob, plus the XOR trick behind a cipher.
- Shifts and masks Shifting left and right to multiply and divide by two, the four one-bit moves every firmware engineer knows (set, clear, toggle, test), pulling a field out of a number, and a scanner eye.

Chapter 3

### When bits mean numbers

- Signed numbers How eight bits hold -128 to 127: two's complement, flip and add one, the edges of an int8_t, one byte read two ways from the knob, and a submarine dive that does not fit.
- Floats and their lies A float is 32 bits of sign, exponent and fraction: ten dimes that miss a dollar by one bit, the bits of 1.0, a number too big to add one to, the knob as a float on the lamps, and comparing with a tolerance.

Chapter 4

### Project

- Project: a binary clock reader Everything in one build: hours in four bits and minutes in six, packed into ten lamps with a shift and an OR, read back with a mask, a mask bug to find and fix, and a quiz that trains you to read the lamps. Then make it yours.

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 Binary, hex and bits

Is Binary, hex and bits free?

Yes. All 7 lessons of Binary, hex and bits 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 Binary, hex and bits take?

About 5 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: Hex shorthand, Shifts and masks and Floats and their lies.

Where do I start?

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