// 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:
}