With less than 200 lines of code, you ve written a complete game for your new
video game console. It s definitely not a blockbuster, but it s actually fun and
a great opportunity to learn about the very basics of game programming.
Also, it should give you enough confidence to implement more advanced
games. You can find a lot of classic games on the web that use nearly the
same hardware we used in this chapter.
What If It Doesn't Work?
From a maker s perspective, this chapter is an easy one. Still, things can go
wrong, especially with the wiring. Make sure you ve connected the right pins
on the Arduino and on the Nunchuk. Also check that the wires tightly fit into
the Nunchuk s and the Arduino s sockets. When in doubt, use wire with a
larger diameter.
Also, check
What If It Doesn t Work?, on page
wrong when generating video signals with the Arduino.
Exercises
• Rewrite the game we implemented in
Motion-Sensing Game Controller, on page
controller. It should support both the analog stick and the accelerometer.
Perhaps you can switch between them using the Nunchuk buttons.
• Tinkering with Nintendo s Wii Motion is more complicated.
and cheap way to sharpen your tinkering skills.
• The TVout library has basic audio support. Connect a piezo buzzer to
digital pin 11 and use the
ities to the video game console. Also, add some sound effects to Pragduino.
3.
See
http://nootropicdesign.com/hackvision/games.html
4.
http://randomhacksofboredom.blogspot.com/2009/07/motion-plus-and-nunchuck-together-on.html
Chapter 9. Tinkering with the Wii Nunchuk
3
143, for all things that can go
Chapter 7, Writing a Game for the
111, so it supports the Nunchuk
tone
and
noTone
functions to add sound capabil-
.
www.it-ebooks.info
162
4
But it s a nice
report erratum
discuss
Need help?
Do you have a question about the Arduino Uno and is the answer not in the manual?