Tweaked phone app for testbed experiment; tweaked testbed files
[iotcloud.git] / version2 / src / others / ino / Temp-Sensor / Temp-Sensor_Fidelius-Cloud.ino
index 3e4441e37d56c4fb63316559585e258952ca61c7..966f04a84bf3c874ae643bbd88428ad0f0e97176 100644 (file)
@@ -14,7 +14,7 @@ SYSTEM_THREAD(ENABLED)
 #define ERRPIN                         D7              // Error pin
 #define DHTTYPE                        DHT22   // DHT 22  (AM2302)
 // IoTCloud
-#define SLEEP_TIME                     15              // Sleep time in seconds
+#define SLEEP_TIME                     300             // Sleep time in seconds
 #define RETRY_SLEEP_TIME       5               // Sleep time in seconds
 #define RETRY_TIME                     10000   // stop trying after 10 seconds
 #define CONNECTION_DELAY       2100000 // Need to delay after connecting WiFi to wait for sensor
@@ -168,7 +168,7 @@ void loop() {
        */
        
        // TODO: Collapse temperature and humidity into one key
-       sprintf(keyBuffer, "humtemp%04x", machineId);
+       sprintf(keyBuffer, "h%04x", machineId);
        IoTString * iKey = new IoTString(keyBuffer);
        // Do updates for the temperature
        sprintf(dataBuffer, "%0.2f-%0.2f", humid, tempF);
@@ -199,6 +199,7 @@ void loop() {
        //Serial.println(micros());
        //while(true);
        
-       System.sleep(SLEEP_MODE_DEEP, SLEEP_TIME);
+       // We randomize sleep/wakeup time
+       System.sleep(SLEEP_MODE_DEEP, random(SLEEP_TIME));
 }