CHAPTER 6
Building a Motion-Sensing Game Controller
It’s astonishing how quickly we get used to new technologies. A decade ago,
not many people would’ve imagined that we would use devices someday to
follow our movements. Today, it’s absolutely normal for us to physically turn
our smartphones when we want to change from portrait to landscape view.
Even small children intuitively know how to use motion-sensing controllers
for video game consoles, such as Nintendo’s Wii. You can build your own
motion-sensing devices using an Arduino, and in this chapter you’ll learn
how.
We’ll work with one of the most widespread motion-sensing devices: the
accelerometer. Accelerometers detect movement in all directions—they notice
if you move them up or down (Z-axis), forward or backward (Y-axis), and to
the left or to the right (X-axis). Many popular gadgets, such as the iPhone
and the Nintendo Wii controllers, contain accelerometers, so accelerometers
are produced in large quantities. That’s why they’re cheap.
Both fun and serious projects can benefit from accelerometers. When working
with your computer, you certainly think of devices, such as game controllers
or other input control devices, that you connect via USB. But you can also
use them when exercising or to control a real-life marble maze. They are also
the right tool for measuring acceleration indirectly, such as in a car.
You will learn how to interpret accelerometer data correctly and how to get
the most accurate results. Then you’ll use an accelerometer to build a motion-
sensing game controller, and in the next chapter you’ll implement a game
that uses it.
report erratum • discuss
www.it-ebooks.info