Serial.print("Dew Point (°C): ");
Serial.print("Dew PointFast (°C): ");
We see the output on the Arduino serial
monitor in Figure 10. Note that this runs the
serial port at 9600 baud.
Two DHT22 Sensors
Adding a second sensor is shown in Figures
11 and 12 in Fritzing breadboard and schematic
views. We connect the second sensor to the
Arduino pin 10 and make a couple of minor
changes in the code. We are now ready to go.
The following source code shows how
simple it is to add a sensor to a project when
you use a library. In the first example, we
created an instance of the dht22 class using
dht22 DHT22. For the example that uses two
sensors, we simply add two instances of the
■ FIGURE 13: DHT22 example with two sensors.
Next, we copy and paste some code as
shown in the listing. We’ll have two sensors
working in a matter of minutes:
■ FIGURE 14: Attic fan.
Serial.println("DHT22 TEST PROGRAM - two
Serial.print("LIBRARY VERSION: ");
int chk0 = DHT220.read();
Serial.print("Read sensor 0: ");
case 0: Serial.println("Sensor 0 OK");
74 September 2013