Yahui Ji Posted June 7, 2021 Report Share Posted June 7, 2021 Here we introduce another way to download firmware to your microcontroller board. With a BLE5.0 & Dual-band WiFi microcontroller, you will never have to worry about re-compiling the code just to change the WiFi SSID and password. Write an introduction for your project How does it work? The working principle of BLE5.0 is working as follows: the Ameba RTL8722DM board will send BLE information to your phone; the phone will send the corresponding WiFi configuration including SSID and password to the RTL8722DM board; the board is able to connect to the WiFi with the same SSID as your phone; #include "BLEDevice.h" #include "BLEWifiConfigService.h" BLEWifiConfigService configService; void setup() { Serial.begin(115200); BLE.init(); BLE.configServer(1); configService.addService(); configService.begin(); // Wifi config service requires a specific advertisement format to be recognised by the app // The advertisement needs the local BT address, which can only be obtained after starting peripheral mode // Thus, we stop advertising to update the advert data, wait for advertising to stop, then restart advertising with new data BLE.beginPeripheral(); BLE.configAdvert()->stopAdv(); BLE.configAdvert()->setAdvData(configService.advData()); BLE.configAdvert()->updateAdvertParams(); delay(100); BLE.configAdvert()->startAdv(); } void loop() { delay(1000); } Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.