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() {
37
37
Serial.println (" BLE Central - LED control" );
38
38
39
39
// start scanning for peripherals
40
- BLE.scan ( );
40
+ BLE.scanForUuid ( " 19b10000-e8f2-537e-4f6c-d104768a1214 " );
41
41
}
42
42
43
43
void loop () {
@@ -54,16 +54,13 @@ void loop() {
54
54
Serial.print (peripheral.advertisedServiceUuid ());
55
55
Serial.println ();
56
56
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 ();
61
59
62
- controlLed (peripheral);
60
+ controlLed (peripheral);
63
61
64
- // peripheral disconnected, start scanning again
65
- BLE.scan ();
66
- }
62
+ // peripheral disconnected, start scanning again
63
+ BLE.scanForUuid (" 19b10000-e8f2-537e-4f6c-d104768a1214" );
67
64
}
68
65
}
69
66
@@ -124,4 +121,6 @@ void controlLed(BLEDevice peripheral) {
124
121
}
125
122
}
126
123
}
124
+
125
+ Serial.println (" Peripheral disconnected" );
127
126
}
You can’t perform that action at this time.
0 commit comments