Example sketches for the new Arduino IDE for ESP8266

Moderator: igrr

User avatar
By martinayotte
#53009 There are 2 kind of OTA, one is a "pull" where the ESP fetch its new firmware from a server, example would be ESP8266httpUpdate, in this case, yes you can use flag or button to trigger that fetch, and another one, the one I've provided link above, is a "push" which listen a specific port for any external request coming "espota.py" tool, so in such case, the "push" doesn't need a special flag or button.
User avatar
By buchacho
#53035 I see. I did try the basic example, however it seemed to slow down the performance of my device. Did you notice any difference? I have a web server, mdns and NTP going also. Any suggestions for optimizations?
User avatar
By martinayotte
#53069 Do you mean the call to ArduinoOTA.handle() in the loop() ?
No ! it should not slow down anything while no OTA operation is done.
It simply check if an OTA request is received, and returns if not.
Your slowdown issue is probably caused by something else.
User avatar
By Barnabybear
#54885 Hi, I'm just looking into this as well.
Asuming you have some thing like this in your sketch already:
Code: Select all#include <ESP8266WiFi.h>
const char* ssid = "<ssid>";
const char* password = "<password>";

void setup() {
  Serial.begin(115200);
  Serial.println("Booting");
  WiFi.mode(WIFI_STA);
  WiFi.begin(ssid, password);
  while (WiFi.waitForConnectResult() != WL_CONNECTED) {
    Serial.println("Connection Failed! Rebooting...");
    delay(5000);
    ESP.restart();
  }
  }
void loop() {
}

is all that needs to be added:
Code: Select all#include <ESP8266mDNS.h>
#include <WiFiUdp.h>
#include <ArduinoOTA.h>

ArduinoOTA.begin(); // added to void setup()

ArduinoOTA.handle();  // added to void loop()

This appears to work - is it realy that simple? Or am I missing something?
Last edited by Barnabybear on Tue Sep 13, 2016 9:27 am, edited 1 time in total.