I’m playing with stickers.
I’m using the “noble” library and the example found here:
The only problem I find is that I can not read whether the sticker is moving or not.
I found this variable:
var isMoving = (data.readUInt8 (15) & 0b01000000) == 1;
But I always return false.
What’s the problem?
I put the stickers on a table and would like to know if it is picked up or not.
Ok, i fixed.
I changed variable ‘isMoving’ in
var isMoving = (data.readUInt8(15) & 0x40) !== 0;
So, the variable is working!.
Ah, of course! A silly bug.
When the 7th bit is set to 1, the value of the entire expression is 64, not 1, so
== 1 doesn’t work, but
!= 0 works perfectly fine.
Great catch, thanks! I updated the example.