Lesson 2 of 7 · about 10 min
Counting with switches
Binary numbers give each switch a value (1, 2, 4, 8…). Add up the switches that are on to get the number.
🧭 What you need first: A room full of light switches
Last lesson, patterns only meant something because we agreed on a code. Now let’s agree on the most useful code of all: how to store numbers.
Picture a row of jars on a shelf. Each jar holds coins, and each jar holds twice as much as the jar to its right:
💰 8 coins · 💰 4 coins · 💰 2 coins · 💰 1 coin
To pay someone 13 coins, you don’t count out 13 single coins. You hand over the 8-jar, the 4-jar and the 1-jar: 8 + 4 + 1 = 13. Every jar is either handed over (1) or kept (0). So 13 becomes 1101.
That’s binary counting. Each switch is a jar, and its value doubles as you move left.
Another way: how you already count
You already use a system like this. In normal numbers, each position is worth 10 times the one to its right: 1s, 10s, 100s. So 352 means 3 hundreds + 5 tens + 2 ones. Binary is the same idea, but each position is worth 2 times the next: 1s, 2s, 4s, 8s. Computers use 2 because a switch only has two positions.
Another way: weights on a scale
Imagine a balance scale and a set of weights: 1 kg, 2 kg, 4 kg and 8 kg. You can weigh anything from 1 to 15 kg by choosing which weights to put on. Each weight is either on the scale (1) or not (0). That’s exactly a 4-bit binary number.
Build numbers out of bulbs
Click the bulbs to turn them on. The number at the bottom is the total of the bulbs that are on. Then try the challenges, and press +1 a few times to watch how counting “carries” over, just like 9 → 10 in normal numbers.
00000000=0
All off = 0
🎯 Challenge 1 of 5: make the number 5
Tip: start with the biggest bulb that isn’t too big, then fill in the rest.
Grown-up words
What you built is a binary number. Each position has a value that doubles as you go left. You read it by adding up the values of the 1s:
00101010 → 32 + 8 + 2 = 42
A group of 8 bits is called a byte. The smallest byte is 00000000 = 0. The biggest is 11111111 = 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 = 255. That’s 256 different values, exactly the 2⁸ from the doubling rule last lesson.
Going the other way (number → binary): start with the biggest value that fits, turn it on, subtract, and repeat with what’s left. For 100: 64 fits (36 left), 32 fits (4 left), 4 fits (0 left). So 100 = 01100100.
Read a binary number
What number is 00010110?
Predict the overflow
A byte holds 11111111 (255). You add 1, and there's no 9th bulb. What does the byte hold now?
What's the biggest number one byte (8 bits) can hold?
Got it?
Finish the lesson to color it in on your map and collect its concept cards.
Did this lesson click?