Prototype for 4-byte BLE communication
This commit is contained in:
parent
703a3e0c38
commit
b2e0851c77
@ -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) {
|
||||
|
||||
@ -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) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user