Before building the network program
Select your exact ESP32 board and confirm a basic upload works first. Use a network compatible with the module; common classic ESP32 boards use 2.4 GHz Wi-Fi. Have the SSID and password ready, but use placeholders when sharing a project. A public or isolated network may prevent devices from reaching each other even when both show a connection.
Build the connection flow
- Start Serial at 9600 baud in Setup.
- Add the Wi-Fi configuration blocks and enter your SSID and password privately.
- Connect with a bounded timeout, such as 10 seconds.
- Use a Wi-Fi connected condition to choose a success or failure branch.
- In the success branch, print a clear message and the assigned IP address. In the failure branch, print a useful failure message.
Use the ESP32-compatible Wi-Fi blocks for the selected board. Do not copy UNO R4 WiFi matrix instructions into an ESP32 program; they refer to hardware the ESP32 board does not have.
Compile and test on the physical board
Verify, then Upload to the ESP32. Open the physical Serial Monitor at the baud rate used by your program. After a successful connection, note the printed IP address. The simulator can help inspect supported program logic, but it does not connect a virtual ESP32 radio to your actual router.
Make connection failures understandable
Check the SSID spelling, password, signal and compatible frequency band. Move closer to the router for an initial test. Recheck the selected board and generated code if the build fails. A successful USB upload does not itself prove successful Wi-Fi authentication. If the module connects but a phone cannot reach it, check guest-network or client-isolation settings.
Build something on the connection
Once connection is reliable, continue with local phone LED control. Keep your connection check before starting network-dependent operations. For a more robust project, choose a retry policy and handle disconnection explicitly rather than repeatedly blocking the entire loop.
Reference: Arduino-ESP32 Wi-Fi API. Keep authentication details out of published screenshots and logs.
