Connecting to local Wi-Fi
Nodes in a Wi-Fi network form a star topology, which means a central hub exists and other nodes connect to the central hub to communicate within the Wi-Fi network. They can also talk to the outside world if the hub is connected to an Internet Service Provider (ISP) as a router. On a Wi-Fi network, we see two different modes of operation:
- Access point (AP) mode
- Station (STA) mode
We can configure ESP32 in both modes. In STA mode, ESP32 can connect to an access point and join a Wi-Fi network as a node. When it is in AP mode, other Wi-Fi-capable devices, such as mobile phones, can connect to the Wi-Fi network that ESP32 starts as the access point. The following figure shows both cases with two different Wi-Fi networks:
Figure 6.1: ESP32 in STA mode and AP mode
Let’s see an example of connecting ESP32 to a Wi-Fi network. In this project, we will develop a class with two callbacks for Wi-Fi-connected and Wi-Fi-disconnected...