// Initialize DHT sensor // NOTE: For working with a faster than ATmega328p 16 MHz Arduino chip, like an ESP8266, // you need to increase the threshold for cycle counts considered a 1 or 0. // You can do this by passing a 3rd parameter for this threshold. It's a bit // of fiddling to find the right value, but in general the faster the CPU the // higher the value. The default for a 16mhz AVR is a value of 6. For an // Arduino Due that runs at 84mhz a value of 30 works. // This is for the ESP8266 processor on ESP-01 DHT dht(DHTPIN, DHTTYPE, 11); // 11 works fine for ESP8266

float humidity, temp_f; // Values read from sensor int temp_c; String webString=""; // String to display // Generally, you should use "unsigned long" for variables that hold time unsigned long previousMillis = 0; // will store last temp was read const long interval = 2000; // interval at which to read sensor

void gettemperature() { // Wait at least 2 seconds seconds between measurements. // if the difference between the current time and last time you read // the sensor is bigger than the interval you set, read the sensor // Works better than delay for things happening elsewhere also unsigned long currentMillis = millis();

// Initialize DHT sensor // NOTE: For working with a faster than ATmega328p 16 MHz Arduino chip, like an ESP8266, // you need to increase the threshold for cycle counts considered a 1 or 0. // You can do this by passing a 3rd parameter for this threshold. It's a bit // of fiddling to find the right value, but in general the faster the CPU the // higher the value. The default for a 16mhz AVR is a value of 6. For an // Arduino Due that runs at 84mhz a value of 30 works. // This is for the ESP8266 processor on ESP-01 DHT dht(DHTPIN, DHTTYPE, 11); // 11 works fine for ESP8266

float humidity, temp_f; // Values read from sensor int temp_c; String webString=""; // String to display // Generally, you should use "unsigned long" for variables that hold time unsigned long previousMillis = 0; // will store last temp was read const long interval = 2000; // interval at which to read sensor

void gettemperature() { // Wait at least 2 seconds seconds between measurements. // if the difference between the current time and last time you read // the sensor is bigger than the interval you set, read the sensor // Works better than delay for things happening elsewhere also unsigned long currentMillis = millis();