Arduino IDE serial monitor does not work when sketch is uploaded wirelessly,
maybe this helps a bit, this code is the junction of 3 sample codes:
ArduinoOTA (BasicOTA), WiFiManager (AutoConnectWithFeedback), and ESP8266WiFi (WiFiTelnetToSerial),
Some functions have been added for testing ,
(change the state of the LED and reset the ESP8266)
Tested with NodeMCU V3 Lolin, the LED is on pin number 2, low state makes the LED (blue) light up.
(User Manual V1.2 - ESP8266 NodeMCU WiFi Devkit)
The sketch line of the code that contains the "DEBUG" setting is used to enable or disable the "admin" password to load the sketch, and the password for Telnet is "PassWd0".
After Telnet logging in, the "led" command toggles the status of the LED, and "reset" will restart ESP8266, as a result, the Telnet connection will be terminated.
You need to use a terminal that connects as a TCP client, to perform the Telnet connection, the program PuTTY.exe and the Hercules SETUP utility worked well.
To make Debug, the Hercules SETUP utility is very useful as it can display the characters in Hexadecimal mode. And you can also keep the tab connected on the serial port and another via TCP Client.
<<< ArduinoOTA: You must have Python 2.7 installed >>>
See here: ESP8266 OTA Updates with Arduino IDE | Over the Air
(Note, the current version of python 2.7 is at 2.7.15, see here: Download Python | Python.org)
First upload is done by serial port, then it is done over the wireless network
- Use the computer and connect to the new Wi-Fi access point, Similar to ESP1475633,
- Enter the ip address in the browser 192.168.4.1,
- Select your router and enter the password,
- The connection to the ESP8266 will be undone,
- Connect the computer back to your wifi network
- You may need to close and reopen the Arduino IDE
Sketch uses 342281 bytes (32%) of program storage space. Maximum is 1044464 bytes.
Global variables use 36492 bytes (44%) of dynamic memory, leaving 45428 bytes for local variables. Maximum is 81920 bytes.
An important consideration for the implementation of Arduino OTA in this case is that the code should not have infinite loops, or with wide time. To circumvent this, instead of using loops with "for" or "while", for example, use the cycle count, or time comparison with the "millis ()" function.
[Troubleshoot]:
If the IDE returns error 11, after uploading via serial port, try pressing the reset button manually to enable the OTA function. Error message:
[ERROR]: Bad Answer: ERR: ERROR[11]: Invalid bootstrapping
Source: esp8266/Arduino/issues/3915
Note: I noticed that the sketch upload gets much faster via Arduino OTA than serial port!
sketch.ino (8.63 KB)