Moderator: igrr
This is pretty easy coding, If I was not so busy I would knock this up for you, would not take longer than an hour or so to implement and test.
Regards
Dans
#include "ESP8266WiFi.h"
const char* ssid = "<your ssid>";
const char* password = "<your password>";
int pin2 = 2;
void setup() {
pinMode(2,OUTPUT);
digitalWrite(pin2,HIGH);
Serial.begin(9600); //debug
// Set WiFi to station mode and disconnect from an AP if it was previously connected
WiFi.mode(WIFI_STA);
WiFi.disconnect();
delay(100);
Serial.println("Void Setup Done"); // debug
}
// Connects to station.
void loop() {
unsigned long TL1S = millis(); // debug
while (WiFi.status() ==! WL_CONNECTED){
WiFi.begin(ssid,password);
digitalWrite(pin2,LOW); //LED ON
delay(900);
digitalWrite(pin2,HIGH); //LED OFF
delay(100);
Serial.println("Not Connected"); //debug
}
// Waits for first RSSI value to be returned (don't comment out).
while (WiFi.RSSI() > 0){
delay(100);
}
unsigned long TL1E = millis(); // debug
// Times above loop and prints out any delay
Serial.print("WiFi loop took "); // debug
Serial.print(TL1E - TL1S); // debug
Serial.println("ms"); // debug
// Puts output on for 100ms then off for time dependant on signal
digitalWrite(pin2,LOW); //LED ON
delay(100);
digitalWrite(pin2,HIGH); //LED OFF
unsigned long rssi = ((WiFi.RSSI())*-10);
delay(rssi);
// Prints out values for RSSI and when converted to delay rssi
Serial.print("RSSI = "); // debug
Serial.print(WiFi.RSSI()); // debug
Serial.print(" rssi = "); // debug
Serial.println(rssi); // debug
Serial.println(""); // debug
}
If you put an LED between 3.3V and GPIO 2 it will flash.
Connecting: 900ms on, 100ms off.
Week signal: 100ms on, upto 1000ms off.
Strong signal; 100ms on, down to 0ms off.
I tried to do this without connecting but scans or filtering was taking 2500 to 3500ms, making the responce to slow to be usefull.