What If It Doesn’t Work? 110
Exercises 110
7. Writing a Game for the Motion-Sensing Game Controller . 111
Writing a GameController Class 112
Creating the Game 114
What If It Doesn’t Work? 124
Exercises 124
8. Generating Video Signals with an Arduino . . . . . 127
What You Need 128
How Analog Video Works 128
Building a Digital-to-Analog Converter (DAC) 130
Connecting the Arduino to Your TV Set 131
Using the TVout Library 133
Building a TV Thermometer 134
Working with Graphics in TVout 139
What If It Doesn’t Work? 143
Exercises 144
9. Tinkering with the Wii Nunchuk . . . . . . . 145
What You Need 145
Wiring a Wii Nunchuk 146
Talking to a Nunchuk 147
Building a Nunchuk Class 148
Using Our Nunchuk Class 152
Creating Your Own Video Game Console 153
Creating Your Own Video Game 153
What If It Doesn’t Work? 162
Exercises 162
10. Networking with Arduino . . . . . . . . . 163
What You Need 164
Using Your PC to Transfer Sensor Data to the Internet 164
Registering an Application with Twitter 167
Tweeting Messages with Processing 168
Communicating Over Networks Using an Ethernet Shield 173
Using DHCP and DNS 177
What If It Doesn’t Work? 180
Exercises 181
Contents • vii
www.it-ebooks.info