Using one of the RobotDyn boards with onboard WiFi and a Generic ESP8266 module.
I can load the sketch, but when WiFi.status()
is called to see if WiFi enabled, the sketch hangs, rebooting the board after ten seconds are so.
void setup() { Serial.begin( 115200 ); Serial.println( "begin - wifi status: " ); // program hangs here - - - - - - - int status = WiFi.status(); Serial.println( status ); }
2 Answers 2
I think it might be a problem with the code you are using, prior to version 2.2.0 of the "ESP Core" the first block of code worked, since only the second version works.
It seems that you can get around it by rather than doing this:
WiFi.begin(ssid, password); // connect to the network
while (WiFi.status() != WL_CONNECTED)
{
delay(500);
}
You should do this:
if (WiFi.status() != WL_CONNECTED)
{
WiFi.begin(ssid, password); // connect to the network
delay (500);
}
Does that look it might be a likely cause?
-
No. I wish to know if WiFi available, so issues
int status = WiFi.status();
. The sketch hangs on this line. (Have added this to question for clarity.)cc young– cc young02/01/2017 04:22:56Commented Feb 1, 2017 at 4:22
Think I found the cause!
I previously had
#include <WiFi.h>
but now using
#include <ESP2866WiFi.h>
This seems to work
I was unaware of the two library sets. Since I use both Arduino MiniPro
and versions of NodeMCU
, am now going through the libraries and determining what breaks.
IMHO, in regard to libraries, NodeMCU
Lua libraries are far, far better than Arduino's
C++ libraries.