0

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 );
}
dda
1,5951 gold badge12 silver badges17 bronze badges
asked Jan 31, 2017 at 9:56

2 Answers 2

1

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?

Sources 1 2

answered Jan 31, 2017 at 12:34
1
  • 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.) Commented Feb 1, 2017 at 4:22
1

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.

answered Feb 9, 2017 at 5:42

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.