Questions: app receive the integer send by Bluetooth

The one UART port is used for communication with one devices only. You cannot connect 2 devices to one port.

yeah, I have changed that, i try it right now. I am not sure if after changing every register is correct. :grin:

hi, i get these numbers finally, like the picture.


and for my app, actually, there should be another two functions, the one is when temperature over 35, and CO2 over 1200, there is alarm wil be ringing
. and i want to have another function is when bluetooth is disconnected
, alarm will ring.Could you help me on that?

321321321

Show your blocks for receiving BT data, it will be informative for future people who will be looking for help.

Why do you attach an mp3 file to the show alert block?

this is my receiving data blocks

yes, i attach MP3 bacause,i want to when disconnect this mp3 file will displaying, this mp3 is 8 second

It would be a good idea to create two global variables "temperature" and "co2". Store data from Bluetooth in variables, then load text for labels from variables.

This should work for bt issues.

in this case , how can i create global variables?
in this way
like that?

I wonder why these blocks work. As temperature you send 1 byte and in the app you read 2 bytes. Generally you send 3 bytes and read 4. Something is wrong here.

yeah, I get this point now. The temperature reading is not correct, but the Co2 reading looks good.

These blocks are draggable. Drag them into your block editor.

blocks - 2023-04-12T193708.498
blocks - 2023-04-12T193711.134

Temperature - 1 signed byte, co2 - 2 unsignet bytes

oh, sorry I send you wrong one, This is my testing code, i initialize it to a 16 bits integer and separated Temperature as 2 8bits integer. But i found app can not detect which is co2 and which is Temperature. so I change it back to 1 Byte number

Can you send here your current send code and your aia project as it's getting a little messy and I don't know what's up to date now.

For co2, receive 2 bytes but not signed. Co2 does not have negative values.

The order in which data is received is crucial. If in your code from the microcontroller you send first 1 byte of temperature and then 2 bytes of co2, in your app you also need to receive 1 byte of temperature first and then 2 bytes of co2.


yeah i just update it

in my test, it still not alarm when bluetooth disconnted. And how can i do this function? temperature over 35, and CO2 over 1200, there is alarm wil be ringing

We'll get to that soon. Yet this:

Can you see the differences between these blocks?

Use for co2 RceivedUnsigned2ByteNumber block