Solution:
Reason Behind This Error:
This implies that the ESP didn’t respond (or didn’t respond in the method that the Arduino IDE expected) at the time you attempted to upload the code. The first thing to attempt is hitting the upload button again. This will mostly solve the problem of everything else is okay. In case that doesn’t perform then attempt unplugging your ESP and re-connecting and attempting again. In case that doesn’t perform then check your Arduino IDE settings. Do you have the right type of device chosen, and the right memory size chosen for your type of device. In case you’re employing an ESP-01, or a device like a Sonoff, then GPIO0 requires to be linked to Ground at the time powering-up the board to place it into flash mode. Failing to do this will result in the type of messages that you’re obtaining. In case you’re employing an ESP-01, or a device like a Sonoff, then GPIO0 requires to be linked to Ground at the time powering-up the board to place it into flash mode. Failing to do this will result in the type of messages that you’re obtaining.
STEP 1:
Begin with reading exact message shown in debug window of Arduino IDE. In many instances it gives direct information where the problem is. For example message above indicates that Arduino IDE is unable to open a serial port COM3. Inspect in case you have chosen port where your module is linked to.
STEP 2:
In case a module is linked to the serial port however not responding as a valid ESP8266 device, the message will read slightly diverse (view below). In case you have other modules linked to your PC, ensure that that you are uploading code to ESP8266 and not to for example Arduino UNO.
STEP 3:
To have your PC talking to ESP, choose exact ESP type in upload menu. In case chosen is mistaken then the upload may fail. Basing on chosen board type, Arduino IDE will exert earmarkd “reset method” to enter the board into boot loading mode. Reset procedures are board specific. Few boards do not have the h/w in place to assistance reset by Arduino IDE. In case this is the reason, you require to enter such board into boot loading mode manually.
STEP 4:
Upload may be also failing due to too high speed. In case you have long or poor quality USB cable, attempt reducing chosen under Upload Speed.