Hi
I am using an AZ Delivery ESP32, VS Code, PlatformIO and ESP-Prog debugger.
What I want to do is:
1 Set the ESP32 up as an access point, scan the local Wifi signals and present the list in a web page.
2 The user selects a wifi signal and enters the password.
3 The ESP32 then exits AP mode and connects to the selected wifi signal with the entered password.
4 The ESP32 then calls a time server to synchronise its clock
5 The ESP32 then periodically sends timestamped data to an mqtt broker.
The problem seems to lie with the AP mode. With hardcoded SSID and password, the time server and mqtt code
work fine, but if the AP and webserver are used, the timeserver code never seems to get an ip address.
I can work around the problem by saving the credentials in flash after step 2, setting a bypass_webserver flag and rebooting,
but I would like to find a tidier solution.
As a test vehicle, I've built the sntp example code and inserted the following after ++boot_count;
// WEBSERVER CODE STARTS HERE >>>>>>>>>>>>>>>>>>>>>>>>>
// Set the esp32 up as an access point and implement a webserver
// The webserver scans the available wifi signals and presents them in a web page
// The user selects the desired signal and enters the password
implement_webserver(); // just start with the soft_ap_example for now, then set webserver_complete
// poll the webserver for a 'complete' status
while (!webserver_complete)
{
vTaskDelay(1 / portTICK_RATE_MS);
webserver_complete = get_complete();
}
shutdown_webserver(); // attempt to remove all trace of the access point/webserver
// get the credentials that the user entered
wifi_credentials = get_credentials();
printf("Wifi credentials are: ssid %s; password %s\n", wifi_credentials.ssid, wifi_credentials.password);
// WEBSERVER CODE ENDS HERE >>>>>>>>>>>>>>>>>>>>>>>>>>
obtain_time();// now try to get the time...
Any ideas. anyone?
Cleaning up after soft_ap_example
Return to “General Discussion”
Jump to
- English Forum
- Explore
- News
- General Discussion
- FAQ
- Documentation
- Documentation
- Sample Code
- Discussion Forum
- Hardware
- ESP-IDF
- ESP-BOX
- ESP-ADF
- ESP-MDF
- ESP-WHO
- ESP-SkaiNet
- ESP32 Arduino
- IDEs for ESP-IDF
- ESP-AT
- ESP IoT Solution
- ESP RainMaker
- Rust
- ESP8266
- Report Bugs
- Showcase
- Chinese Forum 中文社区
- 活动区
- 乐鑫活动专区
- 讨论区
- 全国大学生物联网设计竞赛乐鑫答疑专区
- ESP-IDF 中文讨论版
- 《ESP32-C3 物联网工程开发实战》书籍讨论版
- 中文文档讨论版
- ESP-AT 中文讨论版
- ESP-BOX 中文讨论版
- ESP IoT Solution 中文讨论版
- ESP-ADF 中文讨论版
- ESP Mesh 中文讨论版
- ESP Cloud 中文讨论版
- ESP-WHO 中文讨论版
- ESP-SkaiNet 中文讨论版
- ESP 生产支持讨论版
- 硬件问题讨论
- 项目展示
Who is online
Users browsing this forum: No registered users and 195 guests
- All times are UTC
- Top
- Delete cookies
About Us
Espressif Systems is a fabless semiconductor company providing cutting-edge low power WiFi SoCs and wireless solutions for wireless communications and Internet of Things applications. ESP8266EX and ESP32 are some of our products.