   // First wake up WiFi
   WiFi.on();
   WiFi.connect();
-  // Switch on LED to signal we're reading out the sensor data
-  digitalWrite(ledPin, HIGH);
   // Reading temperature or humidity takes about 250 milliseconds!
   // Sensor readings may also be up to 2 seconds 'old' (its a
   // very slow sensor)
  	float h = dht.getHumidity();
-  // Read temperature as Celsius
+  // Read temperature as Celsius - the lib has a typo...
  	float t = dht.getTempCelcius();
-  // Check if any reads failed and exit early (to try again).
+  // Check if any reads failed and exit early
  	if (isnan(h) || isnan(t)) {
     //Particle.publish("DEBUG", "Failed to read from DHT sensor!");
+    // try again in 10 secs
+    t = readoutTimeIntervalMin*60*5 - 10*5;
     return;
  	}
  	//float hi = dht.getHeatIndex();

 *
 * Changelog:
 * v1.0 - 1-05-2017: initial revision from https://www.hackster.io/shaiss
 * v2.0 - 6-05-2017: added wifi sleep + readout button + refactorization
 *
 *************************************************************************/

// This #include statement was automatically added by the Particle IDE.

// This #include statement was automatically added by the Particle IDE.
#include "Adafruit_DHT/Adafruit_DHT.h"

int dhtPin = 2;                        // DHT sensor pin
int pushButtonPin = D5;                // Push button pin
int readoutTimeIntervalMin = 3;        // perform a readout every given minutes
String thingName = "glp_photon_vth";   // thing name for Dweeter

DHT dht(dhtPin, DHT22);
HttpClient http;
