user37894: I would like to use OTA in some of my less accessible esp's. I am using the examples/BasicOTA and BasicOTA_test. My esp is a -01 model with 1Mb of flash.
I upload the BasicOTA to my esp through the COM port, then upload the BasicOTA_test over WiFi.  Everything appears to go OK, but the test sketch doesn't run until I press reset on the esp.
If I upload BasicOTA over the com port then upload a simple blink sketch over WiFi without the OTA code, it uploads fine then runs without a reset.  But then, I can't upload over WiFi anymore.
If I have to hit reset every time I upload a new sketch that contains the OTA code, then why bother?
Tips would be appreciated.

user33026: I've done some research and this appears to be a common problem while using OTA to update the ESP8266. In fact, this bug has been reported on their GitHub and it's due to the watchdog timer resetting after the ESP8266 is flashed via OTA.
It appears the problem can be solved by manually resetting (once) after you upload it via serial BEFORE you can upload it via OTA. After that, you shouldn't have any problems.

user47672: You can add ESP.restart() in the following line to make it restart. 
ArduinoOTA.onEnd([]() {
Serial.println("\nEnd");
ESP.restart();
});

Now you can upload code each time without hitting reset.

37894: <p>I would like to use OTA in some of my less accessible esp's. I am using the examples/BasicOTA and BasicOTA_test. My esp is a -01 model with 1Mb of flash.</p>

<p>I upload the BasicOTA to my esp through the COM port, then upload the BasicOTA_test over WiFi.  Everything appears to go OK, but the test sketch doesn't run until I press reset on the esp.</p>

<p>If I upload BasicOTA over the com port then upload a simple blink sketch over WiFi without the OTA code, it uploads fine then runs without a reset.  But then, I can't upload over WiFi anymore.</p>

<p>If I have to hit reset every time I upload a new sketch that contains the OTA code, then why bother?</p>

<p>Tips would be appreciated.</p>
 33026: <p>I've done some research and this appears to be a common problem while using OTA to update the ESP8266. In fact, this bug has been reported on their <a href="https://github.com/esp8266/Arduino/issues/2478" rel="nofollow noreferrer">GitHub</a> and it's due to the watchdog timer resetting after the ESP8266 is flashed via OTA.</p>

<p>It appears the problem can be solved by manually resetting (once) after you upload it via serial BEFORE you can upload it via OTA. After that, you shouldn't have any problems.</p>
 47672: <p>You can add <code>ESP.restart()</code> in the following line to make it restart. </p>

<pre><code>ArduinoOTA.onEnd([]() {
Serial.println("\nEnd");
ESP.restart();
});
</code></pre>

<p>Now you can upload code each time without hitting reset.</p>
