Wish extend ESP8266 library

Cableguy

Expert
Licensed User
Longtime User
Hi EREL

You have made a tremendous job with B4R 1.2 and the basic ESP866WIFI lib...
If I have understood correctly, you have created functions to make our life easier in using the esp8266, and we are most thankfull...
But, IoT is nothing without internet, and a WPS would function would make automatic connections a lot easier, than having to hardcode the wifi credentials...

I found a code snippet to do this...

B4X:
// Test For ESP8266 WPS connection.

#include <ESP8266WiFi.h>


void setup() {
  Serial.begin(115200);
  // WPS works in STA (Station mode) only.
  wifi.mode(WIFI_STA);
  Delay(1000);
  // Called To check If SSID And password has already been stored by previous WPS call.
  // The SSID And password are stored in flash memory And will survive a full Power cycle.
  // Calling ("",""), i.e. with blank string parameters, appears To use these stored values.
  wifi.begin("","");
  // Long Delay required especially soon after Power on.
  Delay(4000);
  // Check If wifi is already connected And If Not, begin the WPS process.
  If (wifi.status() != WL_CONNECTED) {
      Serial.println("\nAttempting connection ...");
      wifi.beginWPSConfig();
      // Another long Delay required.
      Delay(3000);
      If (wifi.status() == WL_CONNECTED) {
        Serial.println("Connected!");
        Serial.println(wifi.localIP());
        Serial.println(wifi.SSID());
        Serial.println(wifi.macAddress());
      }
      Else {
        Serial.println("Connection failed!");
      }
  }
  Else {
    Serial.println("\nConnection already established.");
  }
}

void Loop() {
  // put your main code here, To run repeatedly:

}
From what I read, a lot of improvements can be done by placing the wps attempt in a timer, checking for its successfulness, to avoid all those delay() statements...

Also, a chipInfo method would be much appreciated!

So EREL,... Please!!!????
 

Cableguy

Expert
Licensed User
Longtime User
Thanks EREL!!!
 
Top