Building climate control systems use a temperature sensor
to monitor and maintain their settings.
Circuit 2
Arduino Code:
7
Troubleshooting:
Nothing Seems to Happen
is program has no outward indication it is working. To
see the results you must open the Arduino IDE's serial
monitor (instructions on previous page).
Gibberish is Displayed
is happens because the serial monitor is receiving data at
a dierent speed than expected. To x this, click the
pull-down box that reads "*** baud" and change it to
"9600 baud".
Temperature Value is Unchanging
Try pinching the sensor with your ngers to heat it up or
pressing a bag of ice against it to cool it down.
You should be able to read the
temperature your temperature
sensor is detecting on the serial
monitor in the Arduino IDE. If it
isn't working, make sure you have
assembled the circuit correctly and
veried and uploaded the code to
your board or see the troubleshoot-
ing tips below.
Code to Note:
Real World Application:
Open Arduino IDE // File > Examples > SIK Guide > Circuit # 7
What You Should See:
Before using the serial monitor, you must call Serial.begin() to
initialize it. 9600 is the "baud rate", or communications speed. When
two devices are communicating with each other, both must be set to
the same speed.
Serial.begin(9600);
Serial.print() will print everything on the same line. Serial.println() will
move to the next line. By using both of these commands together, you
can create easy-to-read printouts of text and data.
Serial.println(degreesF);
e Serial.print() command is very smart. It can print out almost
anything you can throw at it, including variables of all types,
quoted text (AKA "strings"), etc.
See http://arduino.cc/en/serial/print for more info.
Serial.print(degreesC);
IOREF
RESET
RESET
7-15V
SCL
SDA
AREF
GND
13
12
~11
~10
~9
8
7
~6
~5
4
~3
2
1
0
TX
RX
13
3.3V
5V
GND
GND
VIN
A0
A1
A2
A3
A4
A5
POWER
ANALOG IN
DIGITAL (PWM~)
ON
ISP
TX
RX
IOREF
RESET
RESET
7-15V
SCL
SDA
AREF
GND
13
12
~11
~10
~9
8
7
~6
~5
4
~3
2
1
0
TX
RX
13
3.3V
5V
GND
GND
VIN
A0
A1
A2
A3
A4
A5
POWER
ANALOG IN
DIGITAL (PWM~)
ON
ISP
TX
RX
voltage: 0.73 deg C: 23.24 deg F: 73.84
voltage: 0.73 deg C: 23.24 deg F: 73.84
voltage: 0.73 deg C: 23.24 deg F: 73.84
voltage: 0.73 deg C: 22.75 deg F: 72.96
voltage: 0.73 deg C: 23.24 deg F: 73.84
voltage: 0.73 deg C: 23.24 deg F: 73.84
voltage: 0.73 deg C: 23.24 deg F: 73.84
voltage: 0.73 deg C: 22.75 deg F: 72.96
voltage: 0.73 deg C: 23.24 deg F: 73.84
voltage: 0.73 deg C: 22.75 deg F: 72.96
voltage: 0.73 deg C: 22.75 deg F: 72.96
voltage: 0.73 deg C: 23.24 deg F: 73.84
voltage: 0.73 deg C: 22.75 deg F: 72.96
voltage: 0.73 deg C: 23.24 deg F: 73.84
Page 48