So you're a Noob? Post your questions here until you graduate! Don't be shy.

User avatar
By gabriele.labanca
#71802 Hello there! I'm a newbie here, and concerning electronics in general, so please don't hesitate to tell me if I'm doing anything wrong. Also, I hope this is not a duplicate: I couldn't find any.

This said, I am working on Arduino IDE to connect to NodeMCU; my problem is about ESP8266WiFi.h, which I can get to work in #CODE1, but everything breaks out when I try even to comment an empty line! Sometimes I can't even get it back to working, by uncommenting.

I honestly can't figure out what's wrong, maybe some IDE-NodeMCU misunderstanding? Please tell me if some extra information is needed: as I said, I'm quite a newbie here...

Thanks a lot for your help! :)

#CODE1
Code: Select all// CONFIGURE WIFI
#include "ESP8266WiFi.h"
const char *ssid =   "xxxxxxx";     
const char *pass =  "xxxxxxx";

void setup()
{
  delay(1000);
  Serial.begin(9600);
  Serial.println("BEGIN CONNECTION");

  //SETUP WIFI
  Serial.println("Connecting to ");
  Serial.println(ssid);
  WiFi.begin(ssid, pass);
  while (WiFi.status() != WL_CONNECTED)
  {
    delay(500);
    Serial.print(".");
  }
  Serial.println("WiFi connected");
}

void loop()
{
}
Last edited by gabriele.labanca on Tue Nov 14, 2017 4:38 pm, edited 1 time in total.
User avatar
By Narfel
#71823 Can't see anything wrong with your code, except that you maybe should xxxx out your password.

Couple of ideas:
- What makes you think it is the header file that makes those problems? Can you run/comment out other libraries?

- Did you use http://arduino.esp8266.com/stable/packa ... index.json in the preferences?

- If it really is down to the head file you can try using brackets instead of quotes, although i think the Arduino IDE falls back on either.
User avatar
By gabriele.labanca
#71846 Thanks a lot, Narfel! Unfortunately, it wasn't any of your guesses...

Narfel wrote:Can't see anything wrong with your code, except that you maybe should xxxx out your password.

Right, I'll edit it :)

Narfel wrote:Couple of ideas:
- What makes you think it is the header file that makes those problems? Can you run/comment out other libraries?

I'm also using DHT.h and HX711.h, which seem not to give any problem...

Narfel wrote:- Did you use http://arduino.esp8266.com/stable/packa ... index.json in the preferences?

Actually, I was using http://arduino.esp8266.com/stable/packa ... index.json, but changing to your link doesn't seem to change anything :/

Narfel wrote:- If it really is down to the head file you can try using brackets instead of quotes, although i think the Arduino IDE falls back on either.

I had already tried it, but again, nothing changes.
User avatar
By gabriele.labanca
#71963
Can you post some actual error messages - "everything breaks out " and "CHAOTIC MISBEHAVIOUR" do not give any idea what the actual problem is.


You are right, but I didn't post anything simply because nothing happened, except from the fact that it didn't connect.
Anyways, I found a solution: instead of
Code: Select allWiFi.status() != WL_CONNECTED

I put
Code: Select allWiFi.localIP().toString() == "0.0.0.0"

and everything works well.
Another solution is proposed here: https://stackoverflow.com/questions/433 ... pot-with-c, but I am not sure it works the same.

Thanks everybody!