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 @@ -39,7 +39,7 @@ void setup() {
3939 Serial.println (" BLE Central - LED control" );
4040
4141 // start scanning for peripherals
42- BLE.scan ( );
42+ BLE.scanForUuid ( " 19b10000-e8f2-537e-4f6c-d104768a1214 " );
4343}
4444
4545void loop () {
@@ -56,16 +56,13 @@ void loop() {
5656 Serial.print (peripheral.advertisedServiceUuid ());
5757 Serial.println ();
5858
59- // see if peripheral is advertising the LED service
60- if (peripheral.advertisedServiceUuid () == " 19b10000-e8f2-537e-4f6c-d104768a1214" ) {
61- // stop scanning
62- BLE.stopScan ();
59+ // stop scanning
60+ BLE.stopScan ();
6361
64- controlLed (peripheral);
62+ controlLed (peripheral);
6563
66- // peripheral disconnected, start scanning again
67- BLE.scan ();
68- }
64+ // peripheral disconnected, start scanning again
65+ BLE.scanForUuid (" 19b10000-e8f2-537e-4f6c-d104768a1214" );
6966 }
7067}
7168
@@ -126,6 +123,8 @@ void controlLed(BLEDevice peripheral) {
126123 }
127124 }
128125 }
126+
127+ Serial.println (" Peripheral disconnected" );
129128}
130129
131130/*
You can’t perform that action at this time.
0 commit comments