Yes, you are right, the "Hello World" is working.
And as it relates to your comment
What I don't understand is more like, why I didn't get any feedback from this post@domify80?
... I was side-tracked with other issues.
But now I can reply.
I selected the board as suggested (ESP32 DEV module) and it shows the same behavior as mentioned in (my) post#9, which is
Other Wi-Fi scans with a WEMOS D1 R2 board running fine.
In this case here, I'm assuming it's posting some data returned from the board but not a simple
Serial.print(....)
I'm still thinking it might be related to the library being used in this sketch.
Your thoughts?
That's the boot log. ESP32 starts at 115200bps; typically sketches use that same bit rate, and therefore the Serial Monitor is set to match (to avoid "'non-printable' chars").
After an upload and restart, everything may not be "synced-up" yet, so the boot log is emitted without being "seen" and printed by the Serial Monitor. But doing a reset, you will usually see it.
As for your actual problem, why comment out these?
If you can see the boot log, then after uncommenting those, you should see "Setup done", and "scan start" with every call to loop, with the five-second delay each time; especially if the "hello" is working.
Thanks for replying.
A few thoughts..
a) whether I have enabled/disabled the statements Serial.println("Setup done") or Serial.println("Scan start") shouldn't make any difference to the main functionality of the code.
b) when disabling the statement int n = 0;, how should the variable 'n' be created?
and
c) some further observation, when compiling the sketch for ESP8266 with header ESP8266WiFi.h for a WEMOS D1 R2 board, it's running fine and it's returning the information of the scanned networks, which it is not doing that when compiling and running for an ESP32, neither with selected board ESP Dev Module nor for selected board DOIT ESP32 DEVKIT V1.
My conclusion is at this moment, a) either my board is somehow damaged or something is wrong with the library in WiFi.h (which I actually don't believe).
Or there is something wrong (what I am doing) that is outside of the above description.
Unfortunately I have currently no additional ESP32 MCU at hand to make a further test.
Again, Hello world and Blink are working fine on the ESP32 board.
I'm at a stop at this moment and have no clue how to proceed to resolve the mystery.
TY
The point is that WiFi.scanNetworks() may be hanging, or taking long enough to be equivalent to forever.
After fixing the bit rate, you can see the boot log, which means that "seeing what gets printed" is working. But after that, you're not seeing anything else.
Actually printing something else (repeatedly) before WiFi.scanNetworks() is to narrow down the problem. If you see "Scan start" and then nothing, it's pretty clear.
If you replace the line with just
int n = 0;
you should then see "Scan performed" and "No network found" over and over and over. Which means all of that is working too.
So yeah, you may have a faulty board.
One more thing to try: since this is an ESP32 board, compile with Debug enabled. The bottom section of the IDE's Tools menu contains board-specific options. Some boards have few/none; ESP32 has many.
The second one should be Core Debug Level which defaults to None. Change that to Verbose. Upload and see what it says. When it's working, it's not much more; I got