[dht22] Change pin number
This commit is contained in:
parent
11608c4dcf
commit
d822c410c0
1 changed files with 4 additions and 7 deletions
|
@ -1,7 +1,7 @@
|
||||||
#include "lib/SimpleDHT/SimpleDHT.h"
|
#include "lib/SimpleDHT/SimpleDHT.h"
|
||||||
#include "lib/SimpleDHT/SimpleDHT.cpp"
|
#include "lib/SimpleDHT/SimpleDHT.cpp"
|
||||||
|
|
||||||
const int dhtA_pin = 5;
|
const int dhtA_pin = 7;
|
||||||
|
|
||||||
SimpleDHT22 dhtA;
|
SimpleDHT22 dhtA;
|
||||||
|
|
||||||
|
@ -10,19 +10,16 @@ void setup() {
|
||||||
Serial.println("DHT22 Demo");
|
Serial.println("DHT22 Demo");
|
||||||
Serial.println("==========");
|
Serial.println("==========");
|
||||||
|
|
||||||
Serial.print("Configuring pins - ");
|
|
||||||
pinMode(dhtA_pin, INPUT_PULLUP);
|
|
||||||
Serial.println("done");
|
|
||||||
|
|
||||||
Serial.print("Waiting to warm DHT22 up - ");
|
Serial.print("Waiting to warm DHT22 up - ");
|
||||||
delay(2000); // Give the DHT22 time to warm up
|
delay(2000); // Give the DHT22 time to warm up
|
||||||
Serial.println("done");
|
Serial.println("done");
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
float temp, humidity;
|
float temp = 0, humidity = 0;
|
||||||
|
|
||||||
int read_error = dhtA.read2(dhtA_pin, &temp, &humidity, NULL);
|
int read_error = dhtA.read2(dhtA_pin, &temp, &humidity, NULL);
|
||||||
|
Serial.println("Read complete - analysing result");
|
||||||
if(read_error != SimpleDHTErrSuccess) {
|
if(read_error != SimpleDHTErrSuccess) {
|
||||||
Serial.print("Error: Failed reading from the DHT22. Code: ");
|
Serial.print("Error: Failed reading from the DHT22. Code: ");
|
||||||
Serial.println(read_error);
|
Serial.println(read_error);
|
||||||
|
|
Loading…
Reference in a new issue