Hello everyone,
I'm fairly new to Arduino programming, but for a schoolproject I have to work with the ESP8266. However, now I cannot properly upload the code to the Arduino. I have connected the ESP to the Arduino as shown in the image.
I have changed my board in the IDE to 'Generic ESP8266 Module' and the code is just to get the IP-adress (I got it online):
#include <ESP8266WiFi.h>
const char* ssid = "Lampekap"; // Your WiFi ssid
const char* password = "N3i28KK22i!"; // Your Wifi password;
// the setup function runs once when you press reset or power the board
void setup() {
Serial.begin(115200);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
Serial.print("Attempting to connect to SSID: ");
Serial.print(ssid);
// Attempt to connect to WiFi network:
while (WiFi.status() != WL_CONNECTED) {
Serial.print(".");
// Connect to WPA/WPA2 network. Change this line if using open or WEP network:
// Wait 5 seconds for connection:
delay(5000);
}
Serial.println("");
Serial.println("WiFi connected");
Serial.println("IP address: ");
Serial.println(WiFi.localIP()); //You can get IP address assigned to ESP
}
// the loop function runs over and over again forever
void loop() {
}
However, when uploading the sketch it gives me the following error:
esptool.FatalError: Failed to connect to ESP9266: Invalid head of packet (0xF0)
Or the full message:
Arduino: 1.8.11 (Windows Store 1.8.29.0) (Windows 10), Board: "Generic ESP8266 Module, 80 MHz, Flash, Legacy (new can return nullptr), All SSL ciphers (most compatible), dtr (aka nodemcu), 26 MHz, 40MHz, DOUT (compatible), 1MB (FS:64KB OTA:~470KB), 2, nonos-sdk 2.2.1+100 (190703), v2 Lower Memory, Disabled, None, Only Sketch, 115200"
Executable segment sizes:
IROM : 233148 - code in flash (default or ICACHE_FLASH_ATTR)
IRAM : 26908 / 32768 - code in IRAM (ICACHE_RAM_ATTR, ISRs...)
DATA : 1256 ) - initialized variables (global, static) in RAM/HEAP
RODATA : 796 ) / 81920 - constants (global, static) in RAM/HEAP
BSS : 24968 ) - zeroed variables (global, static) in RAM/HEAP
Sketch uses 262108 bytes (27%) of program storage space. Maximum is 958448 bytes.
Global variables use 27020 bytes (32%) of dynamic memory, leaving 54900 bytes for local variables. Maximum is 81920 bytes.
esptool.py v2.8
Serial port COM3
Connecting......................................____Traceback (most recent call last):
File "C:\Users\timke\Documents\ArduinoData\packages\esp8266\hardware\esp8266\2.6.3/tools/upload.py", line 65, in
esptool.main(cmdline)
File "C:/Users/timke/Documents/ArduinoData/packages/esp8266/hardware/esp8266/2.6.3/tools/esptool\esptool.py", line 2890, in main
esp.connect(args.before)
File "C:/Users/timke/Documents/ArduinoData/packages/esp8266/hardware/esp8266/2.6.3/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: Invalid head of packet (0xF0)
esptool.FatalError: Failed to connect to ESP8266: Invalid head of packet (0xF0)
_
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
Does anyone know what the problem is and maybe even how I can fix it?
Any help would be appreciated.