Skip to content

Commit 3b71bb0

Browse files
committed
Jira 832 Sample Sketch to exercise the BLEbroadcast option.
1. Add example sketch libraries/CurieBLE/examples/peripheral/broadcast
1 parent ff32c97 commit 3b71bb0

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#include <CurieBLE.h>
2+
3+
uint8_t value = 0;
4+
5+
BLEPeripheral peripheral;
6+
BLEService service = BLEService("EEE0");
7+
BLEShortCharacteristic characteristic = BLEShortCharacteristic("EEE1", BLERead | BLENotify | BLEBroadcast);
8+
9+
void setup() {
10+
Serial.begin(9600);
11+
12+
peripheral.setLocalName("BLEBroadcast");
13+
peripheral.setAdvertisedServiceUuid(service.uuid());
14+
15+
peripheral.addAttribute(service);
16+
peripheral.addAttribute(characteristic);
17+
18+
characteristic.setValue(value);
19+
20+
peripheral.begin();
21+
characteristic.broadcast();
22+
23+
Serial.println(F("BLE Broadcast Count"));
24+
}
25+
26+
void loop() {
27+
peripheral.poll();
28+
characteristic.setValue(value);
29+
delay(1000);
30+
value++;
31+
}

0 commit comments

Comments
 (0)