Building a Dice Game

Turning our rudimentary die into a full-blown game requires adding another pushbutton. With the first one we can still roll the die, and with the second one we can program a guess. When we roll the die again and the current result equals our guess, the three LEDs on the die will blink. Otherwise, they will remain dark.

To enter a guess, press the guess button the correct number of times. If you think the next result will be a 3, press the guess button three times and then press the start button.

To add another button to the circuit, do exactly the same thing as you did for the first one. Figure 13, Our binary die now has a guess button shows that we have added yet another button circuit to the breadboard. This time we’ve ...

Get Arduino: A Quick-Start Guide, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.