Hi there all...i am into a project wich read temperature,i have used the LM35 before but beacause of acuracy,and limited lenght of the cable,errors and such ....i decided to do it with the DHT22/RHT03.Reading the temperature with the <DHT22.h> library works great.The code i use is:
#include <DHT22.h>
// Only used for sprintf
#include <stdio.h>
// Data wire is plugged into port 7 on the Arduino
// Connect a 4.7K resistor between VCC and the data pin (strong pullup)
#define DHT22_PIN 7
// Setup a DHT22 instance
DHT22 myDHT22(DHT22_PIN);
void setup(void)
{
// start serial port
Serial.begin(9600);
}
void loop(void)
{
DHT22_ERROR_t errorCode;
// The sensor can only be read from every 1-2s, and requires a minimum
// 2s warm-up after power-on.
delay(2000);
errorCode = myDHT22.readData();
switch(errorCode)
{
case DHT_ERROR_NONE:
Serial.print(myDHT22.getTemperatureC());
Serial.print(" Celsius ");
Serial.print( myDHT22.getHumidity());
Serial.println("% Humidity");
// Alternately, with integer formatting which is clumsier but more compact to store and
// can be compared reliably for equality:
//
char buf[128];
}
}
my intencion is to keep it most simple as posible.can anyone help me with the code to add another sensor,so i can read 2 DHT22?
i realy apreciate it,thank you all of you.
Juycce