I am connecting an Arduino Nano 33 BLE to an Android smartphone to send the detection of a fall. I would like to set an alarm in the app and show the background of a label in red, for instance. My problem seems to be with the data type I am sending. I’ve tried different options: short floats, unsigned integers and bytes. This is the code I use in the Arduino to send an integer, for instance:
BLEUnsignedIntCharacteristic alarmCharacteristic ( BLE_UUID_ALARM_FLAG, BLERead | BLENotify );
FallService.addCharacteristic( alarmCharacteristic );
if (flagmin & flagmax)
And, these are the blocks I use to read the value in appinventor:
When the fall condition is activated, I see the number 1 with green background in the app but I fail to see a red background with the text FALL DETECTED. This seems to be due to a failure in the if block when I compare the received value to 1 but I cannot understand why. How can I do that comparison so I can detect the number 1 effectively?