I checked the TimerEnabled setting with a TimerInterval of 2000 ms. The pressure values now appear on the app updating at every 2000 ms [Thanks to ABG]. In this iteration, the shortfloat setting was set to false. However, when I set the shortfload setting to true, some random values [-0.00067,160000], [495001856, 200000],.... were appearing.
But the problem now is that both values are of sensor A, but just for a fraction of a second, both values are of sensor B. I think I am unable to use the BLE FloatsReceived block correctly. Is there a way to distinguish between the float values of the two sensors? I am attaching my updated blocks.
I was also getting a Runtime Error "No connection with a BLE device" when I turned on the TimerEnabled setting. So I added a block [when BluetoothLE1.RssiChanged, set TimerEnabled to true] which solved the Runtime Error problem.
Thank you, Uskiara. I will also try this tactic. By enabling the clock timer, the float values are now visible on the app but the my blocks are not able to distinguish between float values of the two sensors. I think it will be easier to distinguish them if I convert them to string as you suggested.
Dear @Ahmed_Zaidi,
I've just had a quick look to your .ino.
If you convert the sensor values from float to string, you can put before the value a header like "A:" + valueA and "B:"+valueB. In this case it will be easy in your app to differentiate the two values. When the app receives a string it will search for a matching characters pair "A:" or "B:" an decide accordingly where (in which label) to display the value.
The problem is in the floats received event block.
The event block is trying to tell you about the incoming float with those four local variables, but you ignore the one that tells you which stream of floats it came from.
Thank you ABG! I think I understood what you are suggesting and I am getting closer. I am attaching some pictures. The old .FloatsReceived block looked like this [old image attached]:
When I try to select from different options, I see this [Options image attached]:
I do not see distinct floatValues of the two sensors. So I had to select the 'floatValues' which is what I think you are refering to 'out of sync global'. Is this true?
Thank you Taifun! I just tried this [please check in the attached, whether I did what you suggested] but I see the characteristic UUID values in the sensor value.
If I use it like attached image, I still see sensor A values in both the labels updating at the clock's time interval. But just for a millisecond, I see sensor B values in both the labels.
Can you elaborate?
It might be a good idea to display all 3 local variables from the FloatsReceived event in labels to better understand what is going on
After 2 seconds, the value in the red block of sensor B changes to 0001 and the Sensor C value shows the value of second pressure sensor just for a fraction of a second. I think the problem is also in this block below:
For a fraction of a second, the value in the black box becomes 0001 and so does the value in the red box which at that moment displays sensor B's actual value. Thank you.
I think I found the problem, @Taifun. The characteristicuud has a small 'a' in '181a' while the characteristicuuid of sensor A and sensor B has a capital 'A' in '181A'. This might be the reason why the if/then logic is not working.
@Taifun , @ABG and @uskiara Thank you for sharing your ideas to solve my problem. Instead of comparing the characteristicuuid with characteristicuuid of sensors, I directly campared the characteristicuuid with actual values with lower case a. But I wonder why is the timer block changing UUIDs to lowercase letters?