          Serial.print("motion detected at ");
          Serial.print(duration);
          Serial.println(" sec");                 
-         
+         delay(50);
          azureHttpPost("{deviceId:NeshMKR100Dev1, motion:1,elapsed:"+ duration + "}");
     }
     
     takeLowTime = true;
   } 
   else {
-      digitalWrite(MKR1000_LED, LOW);   // turn LED OFF
-      //delay(150);    
+      digitalWrite(MKR1000_LED, LOW);   // turn LED OFF     
 
        if(takeLowTime){
           lowIn = millis();             //save the time of the transition from high to LOW

const int  MKR1000_PINPIR1 = 14;               // choose the input pin (for PIR sensor)


int val = 0;                    // variable for reading the pin status
long unsigned int lowIn;         //the time when the sensor outputs a low impulse
long unsigned int pause = 5000;  //the amount of milliseconds the sensor has to be low before we assume all motion has stopped

void loop(){
  val = digitalRead(MKR1000_PINPIR1);   // read input value
  if (val == HIGH) {                    // check if the input is HIGH
    digitalWrite(MKR1000_LED, HIGH);    // turn LED ON    

    if (lockLow) {           
         lockLow = false;               //makes sure we wait for a transition to LOW before any further output is made:
