Don’t worry! Of course there’s a library for that. The TVout library
3
not only
generates crystal-clear video signals, but also comes with a lot of utility
functions for drawing geometric shapes. On top of that, it supports different
fonts in several sizes.
Note that the TVout library doesn’t support every Arduino board. For example,
it won’t work on the Arduino Leonardo or the Arduino Due. Check the TVout’s
website for a list of compatible hardware.
Download TVout,
4
unzip it, and copy the contents of the zip archive to the
libraries
folder of the Arduino IDE. Then restart your IDE.
The library comes with a few examples. The most important ones are
DemoNTSC and DemoPAL. In principle, it’s only one example that demon-
strates all of the library’s features, but it comes in two flavors: NTSC and PAL.
This is necessary because there are different standards for analog TV. NTSC
and PAL are two very popular ones. They don’t differ much, and modern TV
sets are usually capable of working with both. Still, your TV set might be
pickier about its input. If you’re living in the United States, you’ll probably
need the NTSC demo; in Europe, PAL is the way to go.
Compile and upload the sketch to your Arduino; then
connect the Arduino to your TV set’s composite input
using the RCA cable. You should see an impressive
demo showing TVout’s capabilities. At the end it even
shows the inevitable rotating 3D cube.
The library’s standard example shows nearly all of
TVout’s functions in action, so it’s a good idea to have
a look at the code. Still, the best way to learn how to use the library is to write
your own code. In the next section, you’ll create a graphical thermometer that
displays the current temperature on your TV screen.
Building a TV Thermometer
To build our TV thermometer, we’ll use the TMP36 sensor again, so we’ll
combine the circuit we created in Increasing Precision Using a Temperature
Sensor, on page 86, with the circuit we created for generating the video signal.
You can see the result in Figure 24, Circuit of the TV thermometer, on page
135.
3.
https://code.google.com/p/arduino-tvout/
4.
https://arduino-tvout.googlecode.com/files/TVoutBeta1.zip
Chapter 8. Generating Video Signals with an Arduino • 134
report erratum • discuss
www.it-ebooks.info