but it was failed. it said like this.
esptool.py v3.0 a fatal esptool.py error occurred: cannot configure port, something went wrong. original message: permissionerror(13, 'a device attached to the system is not functioning.', none, 31)serial port com9 error while setting serial port parameters: 115,200 n 8 1
thank you for replying, so i'm using arduino uno as my microcontroller. And the esp-01 connected with it, and that's why I choose esp8266 as my board in arduino uno.
You have the ESP-01 connected by serial to your UNO, right?
So you have to drive it with AT commands.
If you want to upload code #1 directly to ESP-01 (you won't be able to handle it from the UNO with AT commands anymore) you should do something like this
The code that you posted would be used if you would use an ESP8266 standanlone.
Did you use chatGPT do get this code?
If yes read this to get explained why it does not work
An ESP8266-01 has a AT-firmware flashed into it when you buy it.
You would need to use a code on the arduino that is written for arduino-uno which communicates with the ESP8266-01 over a serial interface.
Big hassle to get connected using the AT-firmware.
It will be much easier to use a different ESP8266-board like a nodeMCU
or
even better to use an ESP32-nodeMCU standalone by eliminating the arduino uno.
The microocntroller-world is not super-standardised like USB-devices and Smartphone-Apps