Cannot uploading on arduino uno with esp8266 board

hi everyone, i just uploaded my coding for my project with esp-1 to show my data to the thingspeak. and here is my code

#include <ESP8266WiFi.h>
#include <ESP8266HTTPClient.h>
#include <WiFiClientSecure.h>

const char* ssid = "";
const char* password = "";

int httpResponseCode;

String serverPath, dataSerial, voltage, current, power;
String serverName = "https://api.thingspeak.com/update?api_key=JKFW18XM7SD103J9";

void writeValue(byte field, String value) {
  WiFiClientSecure client;
  client.setInsecure();
  HTTPClient http;

  serverPath = serverName + "&field" + String(field) + "=" + value;

  http.begin(client, serverPath.c_str());
  httpResponseCode = http.GET();
  
  http.end();
}

void setup() {
  Serial.begin(9600);
  WiFi.begin(ssid, password);

  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
  }
}

void loop() {
  readData();
}

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

what is the solution? thank you

what exact type of microcontroller?
Just mentioning "ESP8266" is not sufficient.

NodeMCU, ESP8266-E, ESP8266-F
at least post a picture of the ESP8266-board

best regards Stefan

1 Like

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.

Security Warning:
You accidentally shared your wifi credentials and api key.
Please remove them.
Thank you.

Not sure if I understand your question but why do you need the 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

ESP01 connected to it.

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

You have to take care of more details than just

"Does the plug fit into the socket"?

best regards Stefan

1 Like

Thank u so much :pray:

yes bro, thanks for your answer, it means a lot :pray:

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.