Hello everyone, I'm developing an app and I'm new to this. My app connects to the ESP32C3 that I'm using, but the data won't change or update; it's stuck at 50. Could you help me fix this?
GLOWTEMP_1 (1).aia (2.0 MB)
Look for a Bluetooth terminal app in the Play Store to test your sketch.
It is probably as broken as your app.
I'm not a BLE user, but this is probably closer to correct than what you had before.
I hooked in your Register for Bytes block after your connection detection.
(I have no idea if your UUIDs are right.)
That should start data flowing without having to repeatedly ask for it.
I also removed two blocks where you try to send data back into a couple of input parameters in your Bytes Received event.
GLOWTEMP_11.aia (2.0 MB)
Bluetooth.ino (2.2 KB)
The UUIDs are correct. To be honest, I don't know if the Arduino code is correct. I've tried your modification, but it's stuck at 50 again :(. The code is supposed to send random data for testing.
Time to upload your .ino sketch code.
(Never mind, I missed it.)
Okay, I think you might be receiving your temperature, but you are asking for it wrong.
That 50 you get is ASCII for '2', which is always the leading digit of the random numbers you generated in the range 20-30. You only asked for item 1 of the list of incoming bytes, so you are probably missing the rest of the incoming message.
You can see the temperatures in the green area of the Terminal data stream (24.99, 22.00, 25.00, 20.00,....) separated by always exactly three bytes of garbage. (The ^@ is one byte, as its each of the other characters before the '2'.)
So here are some things to try:
-
Ask for and register for text, instead of bytes, and show the raw list of textValues in list form, for verification.
-
Continue long the Bytes path, and show all the Bytes in the list, then go through the trouble of trying to convert them into text and build your temperature number from that.
I recommend the first path.
That actually worked, it’s not stuck at 50 anymore. The first time it was refreshing the values for temperature , but right now it's not. I need to disconnect the Bluetooth and connect it again, and then it changes.
GLOWTEMP_12.aia (2.0 MB)