We need to send a control byte from the app to the module, whatever. In this case 0. The BT component will detect connection problems when unable to send a control byte.
In your module code, you can add a line that detects received data and flushes it from the buffer..
Alarm in case of exceeding the temperature should be on all the time until the temperature is too high? Does it only signal once?
it will just display once
sorry, i Get a question, where I can find this sendControlByte, or I just drag this block and name it to sendControlByte?

is this what we need to use?
This is a procedure created and named by me. You can find the procedures in the Procedures tab.
You can drag this block.
Here's another procedure. Alarm procedure.
You can drag it too.
Event BluetoothError calls procedure alarm with appropriate message.

And clock:
I changed the alarm procedure. I gave a dialog instead of an alert so that the user can read what triggered the alarm.
I have question, how t initialize text in the alarm blcok
Click on the blue flower icon in the upper left corner of the procedure. You can add as many variables as you want there.

like in this one? does the variable show like an orange block?
Drag input x to inputs...it's intuitive. Then close the balloon, and change the name from x to whatever you want.
1 Like
I am not quite understand this part, can you explain it?
By default, the background of the label is transparent. After setting the background to red after exceeding the temp, with these blocks I return to the transparent background when the temp goes down.
Now I think that the alarm_temp and alarm_co2 variables need to be made global variables.


great, i get this point, I am fixing on that

for this block, what I got is only three list
I am not sure what are these 255 255 255 0 means
RGB color components and transparency. You can set any color there. It can also be white. This is the least important part of the code. Specifies the color of the label when the temperature is lower than 35 degrees. You can use this block, then label will be white, not transparency.
I set the block with numbers to make it transparent, and that's it.
Bluetoothlab.aia (132.4 KB)
this is what I created, and there is my test result, when Temperature and CO2 reading above certain level, the alarm did not ring and, background color did not change