// Replace xxxxxxxx with pushingbox DEVICE ID int value = 0; TCPClient client; void setup() { //Declare input and output pins pinMode(D0, OUTPUT); pinMode(D7, OUTPUT); pinMode(D5, INPUT_PULLUP); } void loop() { digitalWrite(D7, HIGH); //Turn onboard LED on digitalWrite(D0, HIGH); // Supply power to the circuit from D0 value = digitalRead(D5); //Read value from D5 if (value == HIGH) //If D5 receives power i.e. connection from D7 to ground broken { digitalWrite(D7, LOW); //Turn off onboard LED delay(250); sendToPushingBox(); //Call method to send to pushingbox if (value == LOW); } } void sendToPushingBox() { Serial.println("Start sendToPushingBox"); client.stop(); if (client.connect("api.pushingbox.com", 80)) { client.print("GET /pushingbox?devid="); client.print("xxxxxxxxxxx"); //INSERT DEVICE ID HERE client.println(" HTTP/1.1"); client.print("Host: "); client.println("api.pushingbox.com"); client.println("User-Agent: Spark"); client.println(); client.flush(); } else{ Serial.println("connection failed"); } }