Open BruceCrowthorne opened 7 years ago
Couldnt you instantiate two DHTs by doing
DHT dht;
DHT dht2;
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);
}
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