Can I use with 2 DHT22s?
BruceCrowthorne opened this issue · 2 comments
BruceCrowthorne commented
I have been using two DHT11s and the library that is specific to the DHT11 allows for specifying each sensor with a specific pin.
Can I do this with this new library using two DHT22s?
Thanks
Bruce
factoidforrest commented
Couldnt you instantiate two DHTs by doing
DHT dht;
DHT dht2;
htmltiger commented
Adding the following also works
DHT dht[2];
setup(){
Serial.begin(9600);
dht[0].setup(5); //pin 5
dht[1].setup(23); //pin 23
}
loop(){
int i=0;
while(i<2){
serial.println( dht[i].getTemperature() );
serial.println( dht[i].getHumidity() );
i++;
}
delay(3000);
}