Simple Arduino ESP8266 OTA from server

The following sketch is fully based on the ESP8266httpUpdate.h library and allow to update the firmware
from the http server. It is minimized, it lacks a lot of requirements, but it is functional. For more information,
visit https://arduino-esp8266.readthedocs.io/en/2.4.0/ota_updates/readme.html too.
#include <ESP8266httpUpdate.h>
const char* ssid =     "YourSSID";     // Set your router SSID
const char* password = "YourPassword"; // Set your router password
void setup() {
  WiFi.begin(ssid, password);
  /*connection to WiFi*/
  while (WiFi.status() != WL_CONNECTED) {
  /* warning - the update is done after each reboot now */
  t_httpUpdate_return ret = ESPhttpUpdate.update("http://server/file.bin"); //Location of your binary file
  //t_httpUpdate_return  ret = ESPhttpUpdate.update("https://server/file.bin");
  /*upload information only */
  switch (ret) {
      Serial.printf("HTTP_UPDATE_FAILD Error (%d): %s", ESPhttpUpdate.getLastError(), ESPhttpUpdate.getLastErrorString().c_str());
    case HTTP_UPDATE_OK:
void loop() {
// ...

Feb / 2018