ESP32 LoRa Sensor Monitoring with Web Server (Long Range Communication) project
Arduino version 1.8.13 (using Heltec WiFi LoRa 32 V2 development board)
Error occurs when compiling at line 150 – WiFi.begin(ssid, password);
Hi.
Do you get this error with other web server projects in the course, or only with this one?
Regards,
Sara
This is my first. The code came straight from your sketch. The only changes I made were to the #define BAND 915E6 and the const char* ssid = “…” and const char* password = “…” constants.
I tried Googling the problem but couldn’t understand how to solve it. I hope you can help.
The libraries are up to date but I wonder if the Arduino 1.8.13 build may be the problem.
Hi again.
I’m also using that version of Arduino IDE. So that is not the issue.
Did you install the ESP32 boards’ add-on in the Arduino IDE? What’s the version that you have?
What is the board that you selected in Tools > Board?
Regards,
Sara
I can’t recall exactly the prototype for the begin function but I believe it’s expecting as first parameter a parameter of type char* instead of const char*. Try changing the parameter type of ssid and/or password. ie. Take out the const for one, then the other then both. Also, is either one just a single character? If so, change the double quote to a single quote and try that. A single character is changed to a char type instead of *char (An array char).
Sara – I’m using Heltec WiFi LoRa 32 V2 development board which I selected in the Tools menu. I’m not sure what you mean when you asked if I installed the ESP32 boards’ add-on in the Arduino IDE unless you are referring to this. The puzzling thing is that no one seemed to have a similar problem with your sketch. The only other issue I have is error: ‘class NTPClient’ has no member named ‘getFormattedDate’ formattedDate = timeClient.getFormattedDate(); but I don’t think this should have any bearing on the other issue.
Steve – both ssid and password are multiple characters. When I just went with char* ssid = “GoofiGuest”; I got error: expected ‘{‘ before ‘;’ token char* ssid = [“GoofiGuest”]; Similar error message for char* password
Hi again.
You get the ‘class NTPClient’ has no member named ‘getFormattedDate’ error because you probably haven’t installed the proper NTPClient library. We’re using the library forked by Taranais, not the regular NTP Client library, as mentioned in the tutorial.
Follow the next steps to install this library in your Arduino IDE:
- Click here to download the NTPClient library. You should have a .zip folder in your Downloads
- In your Arduino IDE, go to Sketch > Include Libraries > Add . ZIP Library and choose the library you’ve just downloaded.
After this, that error should go away.
As for the other issue, try with the following:
char* ssid = "YOUR_SSID"; char* password = "YOUR_PASSWORD";
or
char ssid[] = "YOUR_SSID"; const char* password = "YOUR_PASSWORD";
Regards,
Sara
Hi Sara,
Your solution for the NTPClient library worked. Ironically, I had downloaded the NTPClient-master library before and must have deleted the wrong when after the compiler warned than I had multiple libraries. That part works fine now. Thanks!
Unfortunately, your 2nd suggestion (removing the *) didn’t help.I got the same compiler error that I first reported.
your first suggestion to eliminate the const part of the line fixed the compiler error, but I can’t connect to WiFi because while (WiFi.status() != WL_CONNECTED) {…} loops continuously. Out of desperation, I pasted the actual values for ssid and password into WiFi.begin(“…”, “…”) and WiFi still won’t connect.
I even tried your suggestions with the WiFi library example WiFiClient.ino, which uses the same const char* construct and WiFi.begin(ssid, password) statement but I got the same results I experienced with your program. (I’m using WiFi library version 2.0.0).
Clearly the problem is on my end but I can’t figure out what is causing it.
Hi.
When you type the credentials right into WiFi.begin(), it must work and connect.
Unless the credentials are not correct or the Wi-Fi is not working on your board.
Does your board have an antenna? Is it connected properly? Can you check if the antenna is not damaged?
Regards,
Sara