The first demo is used to perform Wi-Fi scanning. We will scan for all existing Wi-Fi networks in the surrounding area in which we are present. First, we will create the ESP32 project, called wifiscan. Our main program is wifiscan.c.
Next, we load all libraries from header files into our program as follows:
#include <string.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "freertos/event_groups.h"
#include "esp_system.h"
#include "esp_wifi.h"
#include "esp_event_loop.h"
#include "esp_log.h"
#include "nvs_flash.h"
#include "lwip/err.h"
#include "lwip/sys.h"
In the main entry app_main() function, we initialize storage for the Wi-Fi program by calling the esp_wifi_set_storage() function. We also need a function to listen to incoming events from...