Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can I use with 2 DHT22s? #8

Open
BruceCrowthorne opened this issue May 18, 2017 · 2 comments
Open

Can I use with 2 DHT22s? #8

BruceCrowthorne opened this issue May 18, 2017 · 2 comments

Comments

@BruceCrowthorne
Copy link

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
Copy link

Couldnt you instantiate two DHTs by doing

DHT dht;
DHT dht2;

@htmltiger
Copy link

htmltiger commented Dec 2, 2019

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);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants