   // set master brightness control
   FastLED.setBrightness(BRIGHTNESS);
 
+  previousPingMillis = millis();
 }
 
 void loop() {
   // update the AnalogMultiButton object every loop
   buttons.update();
+
+  // Ping the server on a specified interval
+  if (millis() > previousPingMillis + pingInterval) {
+    Serial.println("Sending a ping request...");
+    Http::PingResult result;
+    http.pingServer(deviceId, version, &result);
+
+    if (result.update) {
+      t_httpUpdate_return ret = ESPhttpUpdate.update(host, 8080, "/update/" + String(result.newversion));
+      Serial.println(ESPhttpUpdate.getLastErrorString());
+    }
+
+    previousPingMillis = millis();
+  }
 
   //  Debugging buttons
   //  Serial.println(analogRead(A0));

const char *host = "arjan-schouten.nl";
const int port = 4443;

//Create a http handler for connection with the server
Http http = Http(host, port);

//Setup the server with the
ESP8266WebServer server(80);


  if (buttons.onRelease(BUTTON_SEND))
  {
    Serial.println("Message is Recorded, Send message");
    for (int i = 0; i < NUM_LEDS; i++) {
      leds[i] = CRGB::Green;
      FastLED.show();
    }

    http.sendMessage(deviceId, "Hoi!!!");

    for (int k = 0; k < NUM_LEDS; k++) {
      leds[k] = CRGB::Black;
      FastLED.show();
    }
  }

  processWiFi();
#ifdef DEBUG
