ESP8266 board error

Hi all,

I'm trying to connect the ESP8266 to Arduino but keep getting errors. I've downloaded the board in boards manager and I've selected the correct COM port and the correct board. I'll attach the code i used below as well the error message

#include <ESP8266WiFi.h>
#include <ESP8266HTTPClient.h>
WiFiClient client;

const char* ssid = "kyze";
const char* password = "neanpojma";

const int button = 2;
String tobesend;

void setup() 
  {
  pinMode(button, INPUT);
  
  Serial.begin(115200);
  delay(100);
    
  Serial.println();
  Serial.println();
  Serial.print("Connecting to ");
  Serial.println(ssid);
    
  WiFi.begin(ssid, password);
    
  while (WiFi.status() != WL_CONNECTED) 
    {
      delay(500);
      Serial.print(".");
    }
  Serial.println("");
  Serial.println("WiFi connected");  
  Serial.println("IP address: ");
  Serial.println(WiFi.localIP());  
}

void loop() 
{
  if (digitalRead(button) == LOW)
    {
      Serial.print("connecting to ");
      Serial.println("whatsapp");
      
      HTTPClient http; 
      tobesend = "http://api.callmebot.com/whatsapp.php?";
      tobesend = tobesend + "phone=+3859xxxx832"; //ive hidden the number
      tobesend = tobesend + "&text=The+button+on+the+ESP+was+pressed";
      tobesend = tobesend + "&apikey=18xxx0";//and the API key
      http.begin(client,tobesend); 
      int httpCode = http.GET(); 
      if (httpCode > 0) 
          { 
           //Check the returning code
           String payload = http.getString(); //Get the request response payload
           Serial.println(payload); //Print the response payload
          }
      http.end(); //Close connection
    }
   
}

Arduino: 1.8.19 (Windows Store 1.8.57.0) (Windows 10), Board: "Generic ESP8266 Module, 80 MHz, Flash, Disabled (new aborts on oom), Disabled, All SSL ciphers (most compatible), 32KB cache + 32KB IRAM (balanced), Use pgm_read macros for IRAM/PROGMEM, dtr (aka nodemcu), 26 MHz, 40MHz, DOUT (compatible), 1MB (FS:64KB OTA:~470KB), 2, nonos-sdk 2.2.1 (legacy), v2 Lower Memory, Disabled, None, Only Sketch, 115200"

Executable segment sizes:
ICACHE : 32768 - flash instruction cache
IROM : 254024 - code in flash (default or ICACHE_FLASH_ATTR)
IRAM : 26557 / 32768 - code in IRAM (IRAM_ATTR, ISRs...)
DATA : 1504 ) - initialized variables (global, static) in RAM/HEAP
RODATA : 948 ) / 81920 - constants (global, static) in RAM/HEAP
BSS : 25632 ) - zeroed variables (global, static) in RAM/HEAP
Sketch uses 283033 bytes (29%) of program storage space. Maximum is 958448 bytes.
Global variables use 28084 bytes (34%) of dynamic memory, leaving 53836 bytes for local variables. Maximum is 81920 bytes.
esptool.py v3.0
Serial port COM4
Connecting......................................____Traceback (most recent call last):
File "C:\Users\Ivan\Documents\ArduinoData\packages\esp8266\hardware\esp8266\3.0.2/tools/upload.py", line 66, in
esptool.main(cmdline)
File "C:/Users/Ivan/Documents/ArduinoData/packages/esp8266/hardware/esp8266/3.0.2/tools/esptool\esptool.py", line 3552, in main
esp.connect(args.before, args.connect_attempts)
File "C:/Users/Ivan/Documents/ArduinoData/packages/esp8266/hardware/esp8266/3.0.2/tools/esptool\esptool.py", line 529, 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
esptool.FatalError: Failed to connect to ESP8266: Timed out waiting for packet header

Which ESP ? and how have you connected it ? (all connections in a schematic please)
The error message indicates a connection error or the ESP not in the correct boot mode.

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