image

YOU’VE COME A long way, and now you’ve reached your final adventure—the biggest yet! In this adventure, you are going to combine digital input, digital output, analogue input and analogue output to create a marble maze game like the one in Figure 9-1. Inspired by retro pinball machines, your game knows when you’ve scored points and tells you if you’ve achieved a new high score. It counts down to when the next game begins and keeps track of the time remaining in the game. It even has its own sound effects!

image

Figure 9-1 A completed big adventure marble maze game

The game brings together a lot of the different skills you’ve learned from the earlier adventures, but there are a couple of other things for you to learn before you can build your game. The first is how to use a piezo as a sensor. You’ve already used a piezo as a speaker but it is a multitalented component and you can also use it to sense vibrations, which is a vital skill for your marble maze game!

What You Need

You need the following items for your marble maze game. The electronic components that you need are shown in Figure 9-2:

  • A computer
  • An Arduino Uno
  • A USB cable
  • A breadboard
  • Some jumper wires
  • 6 piezos
  • 6 1MΩ resistor
  • 1 red LED
  • 1 yellow LED
  • 1 green LED
  • 3 220Ω resistors
  • 1 panel mount push-to-make button
  • 1 tactile ...

Get Adventures in Arduino 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.