#include <ESP8266WiFi.h>
const char* ssid = "wifiname";
const char* password = "password";
void setup() {
Serial.begin(115200);
delay(10);
Serial.println('\n');
WiFi.begin(ssid, password);
Serial.print("Connecting to ");
Serial.print(ssid);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print('.');
}
Serial.println('\n');
Serial.println("Connection established!");
Serial.print("IP address:\t");
Serial.println(WiFi.localIP());
}
void loop() {
}
When i compile and run my code i get the following error after "Connecting ....." showing in the console. The error is
raise FatalError('Failed to connect to %s: %s' % (self.CHIP_NAME, last_error)). esptool.FatalError: Failed to connect to ESP8266: Invalid head of packet (0x65)