0

This is the error it gives ,this is the error I encounter when i try to upload my code

#include <ESP8266WiFi.h>
#include <ESP8266WiFiMulti.h>

#ifndef STASSID
#define STASSID "your-ssid"
#define STAPSK  "your-password"
#endif

const char* ssid     = STASSID;
const char* password = STAPSK;

const char* host = "192.168.1.1";
const uint16_t port = 3000;

ESP8266WiFiMulti WiFiMulti;

void setup() {
  Serial.begin(115200);

  // We start by connecting to a WiFi network
  WiFi.mode(WIFI_STA);
  WiFiMulti.addAP(ssid, password);

  Serial.println();
  Serial.println();
  Serial.print("Wait for WiFi... ");

  while (WiFiMulti.run() != WL_CONNECTED) {
    Serial.print(".");
    delay(500);
  }

  Serial.println("");
  Serial.println("WiFi connected");
  Serial.println("IP address: ");
  Serial.println(WiFi.localIP());

  delay(500);
}


void loop() {
  Serial.print("connecting to ");
  Serial.print(host);
  Serial.print(':');
  Serial.println(port);

  // Use WiFiClient class to create TCP connections
  WiFiClient client;

  if (!client.connect(host, port)) {
    Serial.println("connection failed");
    Serial.println("wait 5 sec...");
    delay(5000);
    return;
  }

  // This will send the request to the server
  client.println("hello from ESP8266");

  //read back one line from server
  Serial.println("receiving from remote server");
  String line = client.readStringUntil('\r');
  Serial.println(line);

  Serial.println("closing connection");
  client.stop();

  Serial.println("wait 5 sec...");
  delay(5000);
}
3
  • 3
    Need a bit more information, what ESP8266 module are you using? Does it have a Reset swtich that needs to be held to program? Like discussed at this link... tttapa.github.io/ESP8266/… Aug 19, 2020 at 16:10
  • 3
    why are you posting a picture of text? ... you pasted the code, paste the error message also ... if you can't upload then the code is irrelevant and only clutters up the post
    – jsotola
    Aug 19, 2020 at 16:11
  • 1
    Which version of arduino IDE do you use? Try to update
    – Sim Son
    Aug 19, 2020 at 18:47

1 Answer 1

1

Try updating the Serial Driver in your system or try using lesser baud rate, i.e. 9600 instead of 115200.

1
  • You should be able to program an ESP8266 at 500Kbit/s or faster. If it only programs at 9600, something's not right.
    – StarCat
    Aug 24, 2020 at 6:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.