 
   return response.substring(idxHdrEnd + 4);
 }
-

       if(!lockLow && millis() - lowIn > pause){  
           //makes sure this block of code is only executed again after a new motion sequence has been detected
           lockLow = true;        
           duration = (millis() - pause)/1000;              
           Serial.print("motion ended at ");      //output
           Serial.print(duration);
           Serial.println(" sec");    
           delay(50);
          webServiceSucceeded = azureHttpPost("{deviceId:NeshMKR100Dev1, motion:0,timestamp:" + getTimeStamp() + "}");
          //webServiceSucceeded = httpRequest("POST", senduri,"text/plain","{deviceId:NeshMKR100Dev1, motion:0,timestamp:" + getTimeStamp() + "}");
          if(webServiceSucceeded == false)
         {
            Serial.println("retrying webservice call ");
            azureHttpPost("{deviceId:NeshMKR100Dev1, motion:0,timestamp:" + getTimeStamp() + "}");
            //webServiceSucceeded = httpRequest("POST", senduri,"text/plain","{deviceId:NeshMKR100Dev1, motion:0,timestamp:" + getTimeStamp() + "}");
         }
    }
  }

  /* ------Poling for Cloud-to-Device messages------*/
  
  String response = "";
  char c;
  ///read response if WiFi Client is available

///*** Azure IoT Hub Config ***///

unsigned long lastConnectionTime = 0;            
const unsigned long pollingInterval = 30L * 1000L; // 5 sec polling delay, in milliseconds

int status = WL_IDLE_STATUS;

WiFiSSLClient client;
WiFiSSLClient postingClient;

///*** RTCZero Config ***///
/* Create an rtc object */
