Video/TvThermometer/TvThermometer.ino
#include <TVout.h>
#include <fontALL.h>
#include "thermometer.h"
const float
SUPPLY_VOLTAGE = 5.0;
const float
MIN_TEMP = 5.5;
const float
MAX_TEMP = 40.0;
const unsigned int
SCREEN_WIDTH = 120;
const unsigned int
SCREEN_HEIGHT = 96;
const unsigned int
TEMP_SENSOR_PIN = A0;
const unsigned int
SCALE_X_MIN = 8;
const unsigned int
SCALE_Y_MIN = 6;
const unsigned int
SCALE_Y_MAX = 75;
const unsigned int
SCALE_WIDTH = 3;
const unsigned int
SCALE_HEIGHT = SCALE_Y_MAX - SCALE_Y_MIN;
float
current_temperature = 0.0;
unsigned long
last_measurement = millis();
TVout TV;
At the beginning of our program, we include a few header files.
TVout s main class and all of its methods.
all fonts that TVout offers. If you don t want to output any text, you don t
have to include it. The
our thermometer available to our program. I ll explain its content later.
After we ve included all necessary header files, we define a few constants and
variables:
•
SUPPLY_VOLTAGE
defines the Arduino s supply voltage, and
contains the number of the pin to which you ve connected the TMP36
sensor.
•
MIN_TEMP
and
MAX_TEMP
(in degrees Celsius) that the TV thermometer can display.
•
SCREEN_WIDTH
and
SCREEN_HEIGHT
that the Arduino isn t capable of displaying really big screen resolutions.
A width of 120 to 132 pixels and a height of 96 pixels is a reasonable
compromise.
•
SCALE_X_MIN
defines the minimum X position of the thermometer s scale.
SCALE_Y_MIN
and
SCALE_Y_MAX
of the thermometer s scale. We ll need these constants to draw a rectangle
representing the current temperature later.
Chapter 8. Generating Video Signals with an Arduino
fontALL.h
thermometer.h
file makes the graphical representation of
define the minimum and maximum temperatures
define the screen s width and height. Note
define the minimum and maximum Y positions
www.it-ebooks.info
TVout.h
declares
contains the definition of
TEMP_SENSOR_PIN
136
report erratum
discuss
Need help?
Do you have a question about the Arduino Uno and is the answer not in the manual?