Chat freely about anything...

User avatar
By Leandro Silva
#16490
martinayotte wrote:Maybe it try to reconnect using previous Wifi configs which isn't compatible across all firmware/SDK.
In such case, you can erase them by flashing "blank.bin" at 0x0007C000 and 0x0007E000 addresses.


I made a new test and if I write
Code: Select all#include <WiFiClient.h>
#include <ESP8266WiFi.h>

int status = WL_IDLE_STATUS;

WiFiClient client;

void setup()
{
  Serial.begin(115200);
  delay(20);
  Serial.println("WIFI configs");
  WiFi.mode(WIFI_STA);
}

void loop()
{
   Serial.println("connecting to wifi");
  connectWifi();
  connectSocket();
}

boolean connectWifi() {
  int attempts = 0;
  while(status != WL_CONNECTED && attempts < 5){
    status = WiFi.begin(ssid, pass);
    attempts++;
    delay(8000);
  }
 
  if(status == WL_CONNECTED) { return true; }
  else { return false; }
return true;
}

boolean connectSocket() {
  if(client.connect(server,port)){ return true; }
}


It won't print into my serial port. But if I remove "WiFiClient client;" from the begining of my scketch, it works OK (If I remove every reference to "client").
User avatar
By ArnieO
#16491
Leandro Silva wrote:It won't print into my serial port. But if I remove "WiFiClient client;" from the begining of my scketch, it works OK (If I remove every reference to "client").

I think ESP8266WiFi.h should replace WiFiClient.h when using the ESP8266. I don't think you should use both.