OK. I have an app which passes a variety of different one character codes to an ESP32 which then runs a WS2128B LED strip. Cahnge colour, change speed, start, stop. All good.
What happens on the strip is that a single light goes from one end of a strip, (60 lights) to the other, and then back again.
When it has done this, (all the way to the right, then all the way to the left), I send a number 1 back to the app.
The problem is, that although only one "1" comes back, once a single pass, (right, then left), has happened, the app starts frantically adding one to the display.
I can't work out how to insert a picture here.
I'm using block
When Clock Timer do
if Bluetoothclient isConnected and
call Bluetoothcoient BytesAbleToReceive > 0
then
set global_counter to get global_counter + 1
set Counter Text to get global_counter
I know I've isolated the call from the ESP32 back to the app by checking in the Serial Monitor.
All I send from the other end is a 1.
I add that to a counter and display it.
As you say, the 1 seems to repeat and repeat.
You're also right that I don't have a Blue Tooth Receive block.
Do I need one, and if so how do I use it?
Hmm. OK, well, yes, that DOES work.
Nice.
UNTIL I send something else from the app through BlueTooth, which then seems to get the number count going crazy again.
I'm a bit confused.
Looks like sending something is resetting the BlueTooth client?
So your Clock2 Timer is receiving an unsigned byte, and adding its value to your counter.
You haven't posted your ESP32 code, so we have no way of knowing what might have arrived in that byte.
If all you needed was to have consumed that byte, you could have dropped the incoming byte into a variable just to get it out of the buffer, and add 1 to the counter (assuming you just wanted to blindly count the incoming bytes).