January 2015
Beginner
324 pages
7h 42m
English
You’re certainly familiar with a regular die displaying results in a range from one to six. To emulate such a die exactly with an electronic device, you’d need seven LEDs and some fairly complicated business logic. We’ll take a shortcut and display the result of a die roll in binary.
For a binary die, we need only three LEDs to represent the current result. We turn the result into a binary number, and for every bit that is set, we light up a corresponding LED. The following diagram shows how the die results are mapped to LEDs. (A black triangle stands for a shining LED.)

We already know how to control a single LED ...
Read now
Unlock full access