is closed so I have to start a new thread.
So how do I make sure that the Arduino code is actually sending 4 bytes?
volatile int temp = 0; //but have also tried int32_t temp = 0;
pCharTemp ->setValue(temp); //Have phone display current sensor temperature
pCharTemp ->notify();
RegisterForIntegers should be controlling what is sent, right?
Are you sure there isn't a bug when it comes to receiving integers?
RegisterForShorts is working whether value sent is 0 or more.
Did not try extensively ble ( as on my phone I need sometime to power cycle it to make ble work ), but found others using the RegisterForBytes and composing the bytes received to reconstruct the integer
P.S.
And yes, RegisterForIntegers seems not working for me
I just tried this:
(adding 33554432 to the number before sending it, forcing the number of non-zero bytes to be transmitted to be four) and it still doesn't work.
My conclusion is that transfer of integers is broken. Whether the bug is in the Arduino ESP32 BLE library or in the MIT App Inventor I do not know.
Sorry, I've just proved ewpatton's explanation wrong.
There IS a bug.
OK, but you can try a workaround, that typically works fine: i.e. to transmit and receive "strings".
In other words, on the ESP32 you can convert your data to Strings and in your app you can RegisterForStrings and then use the WhenStringsReceived event:
If Services and Characteristics UUID's are correct, it typically works
All the best.
Doing a workaround does not handle the actual bug. But here is my workaround that works:
with
The real solution to this and the closed thread I referenced in my first post in this thread will of course be to FIX THE BUG!
Edit: If course instead of shouting here I should download a generic Android app to see if bug is here or in Arduino's BLE library.
Did you read my first post here?
Ok, so nice to read that at least your WA is working (this will help other users).
Fixing a bug is a matter of MIT team, so I believe that @ewpatton will have a look to this thread.
A good app that can help in finding where could be the root cause is SerialBluetoothTerminal, free on playstore.
Best wishes.
2 Likes