Skip to content

7. Example Adding EPS IDF Project: SoftWiFi Access Point

ronf-ucb edited this page Jan 19, 2021 · 11 revisions

Application programming interface (API) description can be found here, which points to examples.
API Reference

Other example code for esp32 can be found here (missing platformio.ini, which needs to be added):
https://github.com/espressif/esp-idf/tree/master/examples

Example here is for Soft Access Point.

https://github.com/espressif/esp-idf/tree/release/v4.1/examples/wifi/getting_started/softAP
also locally: ~/home/.platformio/packages/framework-espidf/examples/wifi/getting_started

7.1 VS: PlatformIO (ant icon) -> PIO Home -> Projects and Configuration -> + create new project
Name: softAP [no space!]
Board: Adafruit ESP32 Feather (can type esp32, and Feather will be an option)
Framework: Espressif IoT Development Framework
Uncheck use default location
[choose location such as ~/home/EE192/SoftAP]
Finish (Project Wizard thinks for a while)
Get ESPRESSIF window. Ignore. Would you like to configure ‘softAP’-> yes

7.2 Edit platformio.ini to add monitor_speed = 115200

7.3 copy files into src directory:
softap_example_main.c

7.3.1 copy examples/common_components/protocol_examples_common/connect.c, into src directory

7.3.2 delete main.c which was created by PlatformIO

7.4 copy needed header file
./examples/common_components/protocol_examples_common/include/protocol_examples_common.h into include directory

7.4 add defines to platformio.ini (note extra single quotes)
build_flags =
'-D CONFIG_ESP_WIFI_SSID="Huzzah32"'
'-D CONFIG_ESP_WIFI_PASSWORD="1234"'
-D CONFIG_ESP_MAX_STA_CONN=2
-D CONFIG_ESP_WIFI_CHANNEL=1

7.5 Build/upload (CMakeLists.txt in src directory seems to work with src/.)