Arduino Uno: esp8266 wifi module code not uploading

#include <ESP8266WiFi.h>

const char *ssid =  "Liq";     // replace with your wifi ssid and wpa2 key
const char *pass =  "1234567";

WiFiClient client;
 
void setup() 
{
       Serial.begin(9600);
       delay(10);
               
       Serial.println("Connecting to ");
       Serial.println(ssid); 
 
       WiFi.begin(ssid, pass); 
       while (WiFi.status() != WL_CONNECTED) 
          {
            delay(500);
            Serial.print(".");
          }
      Serial.println("");
      Serial.println("WiFi connected"); 
      Serial.println(WiFi.localIP());
}
 
void loop() 
{      
  
}

In the boards sections, I have selected the the generic esp8266 module but still I am not being able to upload the the above code

I am getting the following error message:

Arduino: 1.8.13 (Windows Store 1.8.42.0) (Windows 10), Board: "Arduino, Primo, 80 MHz, Flash, Legacy (new can return nullptr), All SSL ciphers (most compatible), 4MB (FS:2MB OTA:~1019KB), v2 Lower Memory, Disabled, None, Only Sketch, 115200"

Executable segment sizes:

IROM   : 242804          - code in flash         (default or ICACHE_FLASH_ATTR) 

IRAM   : 26892   / 32768 - code in IRAM          (ICACHE_RAM_ATTR, ISRs...) 

DATA   : 1260  )         - initialized variables (global, static) in RAM/HEAP 

RODATA : 796   ) / 81920 - constants             (global, static) in RAM/HEAP 

BSS    : 25000 )         - zeroed variables      (global, static) in RAM/HEAP 

Sketch uses 271752 bytes (26%) of program storage space. Maximum is 1044464 bytes.

Global variables use 27056 bytes (33%) of dynamic memory, leaving 54864 bytes for local variables. Maximum is 81920 bytes.

esptool.py v2.8

Serial port COM3

Connecting........_____....._____....._____....._____....._____....._____.....____Traceback (most recent call last):

  File "C:\Users\Devashish\Documents\ArduinoData\packages\esp8266\hardware\esp8266\2.7.4/tools/upload.py", line 65, in <module>

    esptool.main(cmdline)

  File "C:/Users/Devashish/Documents/ArduinoData/packages/esp8266/hardware/esp8266/2.7.4/tools/esptool\esptool.py", line 2890, in main

    esp.connect(args.before)

  File "C:/Users/Devashish/Documents/ArduinoData/packages/esp8266/hardware/esp8266/2.7.4/tools/esptool\esptool.py", line 483, in connect

    raise FatalError('Failed to connect to %s: %s' % (self.CHIP_NAME, last_error))

esptool.FatalError: Failed to connect to ESP8266: Timed out waiting for packet header

_

the selected serial port _

 does not exist or your board is not connected



This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.