So you're a Noob? Post your questions here until you graduate! Don't be shy.

User avatar
By Kyrylo
#86430 When i connect my esp-015 to arduino, i can see a hotspot appear in my phone wifi settings. So, I decided to write some sample code.
Code: Select all#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
Code: Select allraise FatalError('Failed to connect to %s: %s' % (self.CHIP_NAME, last_error)). esptool.FatalError: Failed to connect to ESP8266: Invalid head of packet (0x65)
. I suspect that my module cant connect but I have no idea why.