@@ -89,15 +89,17 @@ void noteOff(char chan, char note) //channel 1
89
89
BLEService midiSvc (" 03B80E5A-EDE8-4B33-A751-6CE34EC4C700" ); // create service
90
90
91
91
// create switch characteristic and allow remote device to read and write
92
- BLECharacteristic midiChar (" 7772E5DB-3868-4112-A1A9-F2669D106BF3" , BLEWrite | BLEWriteWithoutResponse | BLENotify | BLERead,5 );
92
+ BLECharacteristic midiChar (" 7772E5DB-3868-4112-A1A9-F2669D106BF3" , BLEWrite | BLEWriteWithoutResponse | BLENotify | BLERead, 5 );
93
93
94
94
void setup () {
95
95
Serial.begin (9600 );
96
96
97
97
BLESetup ();
98
- // advertise the service
99
98
99
+ // advertise the service
100
+ BLE.advertise ();
100
101
Serial.println ((" Bluetooth device active, waiting for connections..." ));
102
+
101
103
}
102
104
103
105
void BLESetup ()
@@ -110,7 +112,7 @@ void BLESetup()
110
112
BLE.setAdvertisedServiceUuid (midiSvc.uuid ());
111
113
112
114
// add service and characteristic
113
-
115
+
114
116
midiSvc.addCharacteristic (midiChar);
115
117
BLE.addService (midiSvc);
116
118
@@ -123,7 +125,6 @@ void BLESetup()
123
125
// set an initial value for the characteristic
124
126
midiChar.setValue (midiData, 5 );
125
127
126
-
127
128
}
128
129
129
130
void loop () {
@@ -158,4 +159,4 @@ void midiDeviceDisconnectHandler(BLEDevice central) {
158
159
void midiCharacteristicWritten (BLEDevice central, BLECharacteristic characteristic) {
159
160
// central wrote new value to characteristic, update LED
160
161
Serial.print (" Characteristic event, written: " );
161
- }
162
+ }
0 commit comments