P
P
ProgramDevel2021-05-05 21:12:56
Arduino
ProgramDevel, 2021-05-05 21:12:56

Problem with ESP8266 (ESP-12F)?

I am trying to flash an ESP8266 (ESP-12F) module. Here is the code

#include <ESP8266WiFi.h>
#include <WiFiClientSecure.h>
#include <UniversalTelegramBot.h>
char ssid[] = "***";
char password[] = "***";
#define BOTtoken "***"
WiFiClientSecure client;
UniversalTelegramBot bot(BOTtoken, client);
String keyboardJson = "";
void setup() {
 Serial.begin(9600);
 WiFi.begin(ssid, password);
 while (WiFi.status() != WL_CONNECTED) {
 delay(500);
 }
}
void loop() {
 int numNewMessages = bot.getUpdates(
 bot.last_message_received + 1);
 handleNewMessages(numNewMessages);
}
void handleNewMessages(int numNewMessages) {
 for (int i = 0; i < numNewMessages; i++) {
 String chat_id = String(bot.messages[i].chat_id);
 String text = bot.messages[i].text;
 if (text == "/ledon") {
 Serial.println("turnOn");
 bot.sendMessage(chat_id, "Relay is ON", "");
 }
 if (text == "/ledoff") {
 Serial.println("turnOff");
 bot.sendMessage(chat_id, "Relay is OFF", "");
 }
 if (text == "/start") {
 bot.sendMessageWithReplyKeyboard(chat_id,
 "Choose from one of the following options",
 "", keyboardJson, true);
 }
 }
}


And an error comes out
Serial port COM8
Connecting........_____....._____....._____....._____....._____....._____.....____Traceback (most recent call last):
  File "C:\Users\79857\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4/tools/upload.py", line 65, in <module>
    esptool.main(cmdline)
  File "C:/Users/79857/AppData/Local/Arduino15/packages/esp8266/hardware/esp8266/2.7.4/tools/esptool\esptool.py", line 2890, in main
    esp.connect(args.before)
  File "C:/Users/79857/AppData/Local/Arduino15/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: Invalid head of packet (0x00)
_
выбранный последовательный порт _
 не существует или плата не подключена к нему


Please help, what is wrong? Why can't I flash
(Thanks a lot in advance)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
lonelymyp, 2021-05-06
@lonelymyp

Are you sure it's 8 com port? If yes, then something is probably connected incorrectly.
Give a photo of what you have there, or draw a picture.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question