  }
 
 void loop() {
-  // Wait a minute between measurements.
-  delay(10000);
-  // read and publish sensor data
-  readout();
+  int pushButtonState = digitalRead(pushButton);
+  if(pushButtonState == LOW) {
+    // button was pressed, readout
+    Particle.publish("BUTTON", "Button pressed, reading data");
+    readout();
+    i = 0;
+  }
+  else {
+    i++;
+    // after 5 minutes force a readout
+    if(i == 100) {
+      readout();
+    }
+  }
+  delay(100);
 }


int led = D7;           // internal LED
int pushButton = D5;    // Push button is connected to D5

// Connect pin 1 (on the left) of the sensor to +5V
// Connect pin 2 of the sensor to whatever your DHTPIN is

  { "Accept" , "*/*"},
  { NULL, NULL } // NOTE: Always terminate headers will NULL
};
http_request_t request;
http_response_t response;

