@@ -28,7 +28,7 @@ BleService ledService("19B10010-E8F2-537E-4F6C-D104768A1214"); // create service
28
28
29
29
30
30
// create switch characteristic and allow remote device to read and write
31
- BleCharCharacteristic switchCharacteristic (" 19B10011-E8F2-537E-4F6C-D104768A1214" , BleRead | BleWrite);
31
+ BleCharCharacteristic ledCharacteristic (" 19B10011-E8F2-537E-4F6C-D104768A1214" , BleRead | BleWrite);
32
32
// create button characteristic and allow remote device to get notifications
33
33
BleCharCharacteristic buttonCharacteristic (" 19B10012-E8F2-537E-4F6C-D104768A1214" , BleRead | BleNotify); // allows remote device to get notifications
34
34
@@ -38,13 +38,13 @@ void setup() {
38
38
pinMode (buttonPin, INPUT); // use button pin 4 as an input
39
39
40
40
// set a name for the BLE peripheral. Max length is 20 characters:
41
- blePeripheral.setLocalName (" Curie LED_Switch Sketch" );
41
+ blePeripheral.setLocalName (" Curie ButtonLed Sketch" );
42
42
// set the UUID for the service this peripheral advertises:
43
43
blePeripheral.setAdvertisedServiceUuid (ledService.uuid ());
44
44
45
45
// add service and characteristics
46
46
blePeripheral.addAttribute (ledService);
47
- blePeripheral.addAttribute (switchCharacteristic );
47
+ blePeripheral.addAttribute (ledCharacteristic );
48
48
blePeripheral.addAttribute (buttonCharacteristic);
49
49
50
50
// advertise the service
@@ -65,13 +65,13 @@ void loop() {
65
65
66
66
if (buttonChanged) {
67
67
// button state changed, update characteristics
68
- switchCharacteristic .setValue (buttonValue);
68
+ ledCharacteristic .setValue (buttonValue);
69
69
buttonCharacteristic.setValue (buttonValue);
70
70
}
71
71
72
- if (switchCharacteristic .written () || buttonChanged) {
72
+ if (ledCharacteristic .written () || buttonChanged) {
73
73
// update LED, either central has written to characteristic or button state has changed
74
- if (switchCharacteristic .value ()) {
74
+ if (ledCharacteristic .value ()) {
75
75
Serial.println (" LED on" );
76
76
digitalWrite (ledPin, HIGH);
77
77
} else {
0 commit comments