Browse Source

add dht11arduino

master
Jakub Škrabánek 1 year ago
parent
commit
8256637dd9
  1. 18
      dht11examplegit/dht11examplegit.ino

18
dht11examplegit/dht11examplegit.ino

@ -0,0 +1,18 @@
#include <DHT11.h>
DHT11 dht11(2);
void setup() {
Serial.begin(9600);}
void loop() {
int temperature = dht11.readTemperature();
if (temperature != DHT11::ERROR_CHECKSUM && temperature != DHT11::ERROR_TIMEOUT) {
Serial.print("DHT11: ");
Serial.print(temperature);
} else {
Serial.print("ERROR: ");
Serial.println(DHT11::getErrorString(temperature));
}
}
Loading…
Cancel
Save