File tree Expand file tree Collapse file tree 2 files changed +31
-1
lines changed
examples/peripheral/broadcast Expand file tree Collapse file tree 2 files changed +31
-1
lines changed Original file line number Diff line number Diff line change 1+ #include < CurieBLE.h>
2+
3+ uint8_t value = 0 ;
4+
5+ BLEService service = BLEService(" EEE0" );
6+ BLEShortCharacteristic characteristic = BLEShortCharacteristic(" EEE1" , BLERead | BLENotify | BLEBroadcast);
7+
8+ void setup () {
9+ Serial.begin (9600 );
10+
11+ BLE.setLocalName (" BLEBroadcast" );
12+ BLE.setAdvertisedServiceUuid (service.uuid ());
13+
14+ BLE.addService (service);
15+ service.addCharacteristic (characteristic);
16+
17+ characteristic.setValue (value);
18+
19+ BLE.begin ();
20+ characteristic.broadcast ();
21+
22+ Serial.println (F (" BLE Broadcast Count" ));
23+ }
24+
25+ void loop () {
26+ BLE.poll ();
27+ characteristic.setValue (value);
28+ delay (1000 );
29+ value++;
30+ }
Original file line number Diff line number Diff line change @@ -294,8 +294,8 @@ bool BLECharacteristic::broadcast()
294294 if (BLEDeviceManager::instance ()->advertising ())
295295 {
296296 BLEDeviceManager::instance ()->stopAdvertising ();
297- BLEDeviceManager::instance ()->startAdvertising ();
298297 }
298+ BLEDeviceManager::instance ()->startAdvertising ();
299299 return _broadcast;
300300}
301301
You can’t perform that action at this time.
0 commit comments