File tree Expand file tree Collapse file tree 1 file changed +8
-9
lines changed
libraries/CurieBLE/examples/central/led_control Expand file tree Collapse file tree 1 file changed +8
-9
lines changed Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ void setup() {
3737 Serial.println (" BLE Central - LED control" );
3838
3939 // start scanning for peripherals
40- BLE.scan ( );
40+ BLE.scanForUuid ( " 19b10000-e8f2-537e-4f6c-d104768a1214 " );
4141}
4242
4343void loop () {
@@ -54,16 +54,13 @@ void loop() {
5454 Serial.print (peripheral.advertisedServiceUuid ());
5555 Serial.println ();
5656
57- // see if peripheral is advertising the LED service
58- if (peripheral.advertisedServiceUuid () == " 19b10000-e8f2-537e-4f6c-d104768a1214" ) {
59- // stop scanning
60- BLE.stopScan ();
57+ // stop scanning
58+ BLE.stopScan ();
6159
62- controlLed (peripheral);
60+ controlLed (peripheral);
6361
64- // peripheral disconnected, start scanning again
65- BLE.scan ();
66- }
62+ // peripheral disconnected, start scanning again
63+ BLE.scanForUuid (" 19b10000-e8f2-537e-4f6c-d104768a1214" );
6764 }
6865}
6966
@@ -124,4 +121,6 @@ void controlLed(BLEDevice peripheral) {
124121 }
125122 }
126123 }
124+
125+ Serial.println (" Peripheral disconnected" );
127126}
You can’t perform that action at this time.
0 commit comments