Adjusting BLE communication
This commit is contained in:
parent
703a3e0c38
commit
359eb64f30
8
src/lightingFirmware/esp32_test0/.theia/launch.json
Normal file
8
src/lightingFirmware/esp32_test0/.theia/launch.json
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
// Use IntelliSense to learn about possible attributes.
|
||||
// Hover to view descriptions of existing attributes.
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
|
||||
]
|
||||
}
|
||||
@ -27,7 +27,7 @@ BLECharacteristic* pCharacteristic = NULL;
|
||||
bool deviceConnected = false;
|
||||
bool oldDeviceConnected = false;
|
||||
uint32_t value = 0;
|
||||
String btmessage;
|
||||
uint32_t btmessage;
|
||||
|
||||
// See the following for generating UUIDs:
|
||||
// https://www.uuidgenerator.net/
|
||||
@ -288,7 +288,7 @@ void setup() {
|
||||
pAdvertising->setScanResponse(false);
|
||||
pAdvertising->setMinPreferred(0x0); // set value to 0x00 to not advertise this parameter
|
||||
BLEDevice::startAdvertising();
|
||||
Serial.println("Waiting a client connection to notify...");
|
||||
Serial.println("\nWaiting a client connection to notify...");
|
||||
|
||||
pinMode(INTERRUPT_PIN, INPUT_PULLUP);
|
||||
attachInterrupt(digitalPinToInterrupt(INTERRUPT_PIN), isr, RISING);
|
||||
@ -305,7 +305,8 @@ void loop() {
|
||||
|
||||
// notify changed value
|
||||
if (deviceConnected) {
|
||||
btmessage = pCharacteristic->getValue().c_str();
|
||||
btmessage = pCharacteristic->getData();
|
||||
// Serial.print(btmessage);
|
||||
mode = btmessage.toInt();
|
||||
}
|
||||
// disconnecting
|
||||
@ -331,6 +332,7 @@ void loop() {
|
||||
button1.pressed = false; // Reset button status to FALSE
|
||||
};
|
||||
if (modeOld != mode){
|
||||
Serial.printf("\nCurrently received data is %p", btmessage);
|
||||
Serial.printf("\nChanging Lighting Preset to Preset %d", mode);
|
||||
}
|
||||
// Wait until the packet is finished being sent before proceeding.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user