# arduino开发RTL8720蓝牙配网断电自动重连

**URL:** <https://forum.amebaiot.com/t/arduino-rtl8720/1594>\
**Category:** BT\
**Tags:** 中文, rtl872xd\
**Created:** [December 12, 2022, 3:26am UTC](https://forum.amebaiot.com/t/arduino-rtl8720/1594 "2022-12-12T03:26:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![kal](https://avatars.discourse-cdn.com/v4/letter/k/9de053/32.png) [@kal](https://forum.amebaiot.com/u/kal)\
**Post date:** [December 12, 2022, 3:26am UTC](https://forum.amebaiot.com/t/arduino-rtl8720/1594/1 "2022-12-12T03:26:44Z")

</div>

蓝牙配网是不支持断电重连吗，还是我设置错误了，那这个配网只能一次性的？没搞懂，哪个大神看看，应该说配网信息应该是保存到flash，上电以后自动重连才是。

```auto
  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();

```

---

<div class="post-metadata">

**Author:** ![wyy](https://avatars.discourse-cdn.com/v4/letter/w/bc8723/32.png) [@wyy](https://forum.amebaiot.com/u/wyy)\
**Post date:** [December 12, 2022, 7:14am UTC](https://forum.amebaiot.com/t/arduino-rtl8720/1594/2 "2022-12-12T07:14:37Z")

</div>

@kal

Arduino SDK 没有自动将 WiFi 网络保存到闪存并从闪存读取 WiFi 网络重新连接的功能。 如果您需要此功能，您可以考虑使用 GitHub SDK([GitHub - ambiot/ambd\_sdk: Release SDK for AmebaD](https://github.com/ambiot/ambd_sdk/))，包含 WiFi 保存和自动断电重新连接，以及蓝牙配网。
