Send data to esp32 on request via bluetooth

I am currently running a stepper motor using an esp32 and I am using the app inventor to send it two values. I am currently able to get it working with a button and two sliders one for each value but I would like it to continue running untill one of the sliders has changed.
I have tried to use a timer to send the values every 100 milliseconds but the stepper motor would skip steps and seemed to be sending random values. I then tried to send a 1 using SerialBT.println("1"); everytime i called bluetooth availaible and when I connected my phone to the Serial bluetooth terminal it was receiving 1's. I was then able to receive it but my compare text function(globalVariable = "1") never seemed to come true.
So overall I would like my stepper to move, check the sliders and then move again with the new values automatically.
I will copy my code once I figure out how but won't be till later, its 5am currently.

Any help is appreciated,
Thank you in advance


Those are the blocks I currently have. It seems to receive the 1 and place it in label 2 but it never seems to go through the comparator to change label 2 to "2".

Post the sketch code too.

Hello @Radaga_Mafesto,
in addition to what @abg has already said, you can try to make a wider search for "1" instead of looking for the exact match.
image
Please be aware that if your ESP32 sends the data with a Serial.println() probably the frame sent contains the copy of characters 0x0D and 0x0A (CRLF) and this can foolish the exact match.
Best wishes.

@uskiara you're an absolute legend, I tried your suggestion and it worked. I have now decided to re do it with BLE and notify but I appreciate the time you took to help me and will definately remember your advice for future reference.

1 Like