This example shows how to use the Wi-Fi Station functionality of the Wi-Fi driver of ESP for connecting to an Access Point and also implementing a reconnetion and adding a LED to show the connection status.
Note: Take in consideration the ways to reconnect indicated in the docs, where it is stated that: "the reconnection may not connect the same AP if there are more than one APs with the same SSID. The reconnection always select current best APs to connect".
Open the project configuration menu (idf.py menuconfig
).
In the WiFi station with reconnection
menu:
- Set the Wi-Fi configuration.
- Set
WiFi SSID
. - Set
WiFi Password
.
- Set
- Set LED GPIO:
- Indicate the GPIO that is connected to the LED. Default 2.
Optional: If you need, change the other options according to your requirements.
You need a ESP32 basic Devboard, this was tested with a NodeMCU.
To use the LED to show the connection status you must indicate the GPIO, in the case of the Devboard used in this example the GPIO is 2.
ESP32 | DESCRIPTION |
---|---|
GPIO2 | LED |
- Last compile: 07 November 2023.
- Last test: 07 November 2023.
- Last compile espidf version:
v 5.1.1
. - VSCode ESP-IDF Visual Studio Code Extension
v 1.6.5
.
Apache License, Version 2.0, January 2004.
v 1.2.1