diff --git a/src/lightingFirmware/SimpleBleDevice/SimpleBleDevice.ino b/src/lightingFirmware/SimpleBleDevice/SimpleBleDevice.ino index 531d07a..45cfc64 100644 --- a/src/lightingFirmware/SimpleBleDevice/SimpleBleDevice.ino +++ b/src/lightingFirmware/SimpleBleDevice/SimpleBleDevice.ino @@ -70,8 +70,8 @@ void setup() { void loop() { // notify changed value if (deviceConnected) { - btmessage = pCharacteristic->getValue().c_str(); - mode = btmessage; + btmessage = pCharacteristic->getData(); + mode = btmessage; } // disconnecting if (!deviceConnected && oldDeviceConnected) { diff --git a/src/lightingFirmware/esp32_test0/esp32_test0.ino b/src/lightingFirmware/esp32_test0/esp32_test0.ino index a5c9dc5..7b3696e 100644 --- a/src/lightingFirmware/esp32_test0/esp32_test0.ino +++ b/src/lightingFirmware/esp32_test0/esp32_test0.ino @@ -255,6 +255,7 @@ void dmxSetup() { void setup() { Serial.begin(115200); + delay(2000); Serial.print("\nIf you receive this message, ESP32 module has finished setting up Serial Interface for communication."); // Create the BLE Device BLEDevice::init("Pupilometer LED Billboard"); @@ -288,11 +289,10 @@ 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); - delay(2000); dmxSetup(); const dmx_port_t dmx_num = DMX_NUM_1; Serial.println("Welcome to Pupilometer LED Billboard!"); @@ -305,8 +305,13 @@ void loop() { // notify changed value if (deviceConnected) { - btmessage = pCharacteristic->getValue().c_str(); - mode = btmessage.toInt(); + Serial.printf("\nI received the following string: %s",String(pCharacteristic->getValue())); + Serial.printf("\nI received the following bytes: "); + uint8_t* btMessage = pCharacteristic->getData(); + for (int i = 0; i < sizeof(btMessage); i++){ + Serial.printf("%d ",btMessage[i]); + }; + delay(100); } // disconnecting if (!deviceConnected && oldDeviceConnected) {