How do i connect to a wifi network using an ESP32

Hello every one, I’m new using RTOS and I don’t really know how to connect my ESP 32 to a WIFI network.

I’ve been looking for some examples but can’t find anything.

1 Like

Hi and welcome! You can use any networking example together with ESP32 and WiFi, e.g. examples/gnrc_networking.

WiFi credentials currently have to be configured at compile-time in the Makefile:

CFLAGS += -DESP_WIFI_SSID=\"your_wifi_ssid\"
CFLAGS += -DESP_WIFI_PASS=\"your_wifi_password\"

Also make sure to select the esp_wifi module:

USEMODULE += esp_wifi

(otherwise esp_now will be the default. This can be used for peer-to-peer/mesh communication between multiple ESPs without an access point)

1 Like

Hi,

Thanks @benpicco for your post, that helped me a lot.

However, the need to set the Wi-Fi credentials at compile time is not very flexible, especially in the case where nodes must be deployed to various end-users networks. If they could be set via the serial terminal, it would be great. Is there any plan to change this ?

Yes this has been implemented for atwinc15x0, it still needs to be wired up for esp_wifi.