WiFi.RSSI() example not working

Hi!

I am trying to use the WiFi.RSSI() example to be found at WiFi - Arduino Reference with no success on a wemos

the code is exactly as in the site:

#include <SPI.h>
#include <WiFi.h>

//SSID of your network 
char ssid[] = "leo-link";
//password of your WPA Network 
char pass[] = "supergeheim";


void setup()
{ 
 WiFi.begin(ssid, pass);

  if (WiFi.status() != WL_CONNECTED) { 
    Serial.println("Couldn't get a wifi connection");
    while(true);
  } 
  // if you are connected, print out info about the connection:
  else {
   // print the received signal strength:
  long rssi = WiFi.RSSI();
  Serial.print("RSSI:");
  Serial.println(rssi);
  }
}

void loop () {}

what I get in the serial monitor is the following:

"ets Jan 8 2013,rst cause:4, boot mode:(1,7)

wdt reset"

any ideas?

What board? What core? Explain how you are uploading this sketch. Have you uploaded simpler sketches successfully?

wemos d1 mini

https://wiki.wemos.cc/products:d1:d1_mini

yes I have

camilozk:

 WiFi.begin(ssid, pass);

if (WiFi.status() != WL_CONNECTED) {
    Serial.println("Couldn't get a wifi connection");
    while(true);
  }

That while loop causes the watch dog timer to reset the chip.
You can't just expect the WiFi to be connected after a fraction of a second.

Pieter

interesting. this example is taken from the arduino wifi.rssi site

camilozk:
interesting. this example is taken from the arduino wifi.rssi site

WiFi - Arduino Reference

That would work on an Arduino, but the ESP8266 isn't an Arduino.

ok... I see.

is there an easy modification to adapt it to esp8266, or is it more complicated than that?

thanks awol for the clarification

You could put a simple state machine into loop().

Here's what I use to get the WiFi quality in my ESP8266 projects:

Pieter

thanks guys, I will try it out!