Please follow our GitHub: "ambiot" for more information and the most updated features: https://github.com/ambiot
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:
1. the Ameba RTL8722DM board will send BLE information to your phone;
2. the phone will send the corresponding WiFi configuration including SSID and password to the RTL8722DM board;
3. 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);
}