@@ -80,16 +80,16 @@ void setup() {
8080
8181 // Create a BLE Characteristic
8282 pTxCharacteristic = pService->createCharacteristic (
83- CHARACTERISTIC_UUID_TX,
84- BLECharacteristic::PROPERTY_NOTIFY
85- );
86-
83+ CHARACTERISTIC_UUID_TX,
84+ BLECharacteristic::PROPERTY_NOTIFY
85+ );
86+
8787 pTxCharacteristic->addDescriptor (new BLE2902 ());
8888
8989 BLECharacteristic * pRxCharacteristic = pService->createCharacteristic (
90- CHARACTERISTIC_UUID_RX,
91- BLECharacteristic::PROPERTY_WRITE
92- );
90+ CHARACTERISTIC_UUID_RX,
91+ BLECharacteristic::PROPERTY_WRITE
92+ );
9393
9494 pRxCharacteristic->setCallbacks (new MyCallbacks ());
9595
@@ -103,23 +103,23 @@ void setup() {
103103
104104void loop () {
105105
106- if (deviceConnected) {
107- pTxCharacteristic->setValue (&txValue, 1 );
108- pTxCharacteristic->notify ();
109- txValue++;
110- delay (10 ); // bluetooth stack will go into congestion, if too many packets are sent
111- }
112-
113- // disconnecting
114- if (!deviceConnected && oldDeviceConnected) {
115- delay (500 ); // give the bluetooth stack the chance to get things ready
116- pServer->startAdvertising (); // restart advertising
117- Serial.println (" start advertising" );
118- oldDeviceConnected = deviceConnected;
119- }
120- // connecting
121- if (deviceConnected && !oldDeviceConnected) {
122- // do stuff here on connecting
123- oldDeviceConnected = deviceConnected;
124- }
106+ if (deviceConnected) {
107+ pTxCharacteristic->setValue (&txValue, 1 );
108+ pTxCharacteristic->notify ();
109+ txValue++;
110+ delay (10 ); // bluetooth stack will go into congestion, if too many packets are sent
111+ }
112+
113+ // disconnecting
114+ if (!deviceConnected && oldDeviceConnected) {
115+ delay (500 ); // give the bluetooth stack the chance to get things ready
116+ pServer->startAdvertising (); // restart advertising
117+ Serial.println (" start advertising" );
118+ oldDeviceConnected = deviceConnected;
119+ }
120+ // connecting
121+ if (deviceConnected && !oldDeviceConnected) {
122+ // do stuff here on connecting
123+ oldDeviceConnected = deviceConnected;
124+ }
125125}
0 commit comments