No, it's a JS hack (I've changed it so it'll be more obvious in 1v86's documentation) - doing a binary OR (|) with 0 converts the number to an integer (it's like using Math.floor, but takes less space).
I'm not 100% sure it's needed as it may happen automatically, but the number that is advertised via Bluetooth is an integer, not floating point.
If you're working on other phone software for Bluetooth LE, you could take a look at using 'Nordic UART' - I think they have posted some example code. Basically then you can send JavaScript direct to Espruino - so if you want to show something on the LEDs you can literally just send show(0xFF)\n
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
No, it's a JS hack (I've changed it so it'll be more obvious in 1v86's documentation) - doing a binary OR (
|
) with 0 converts the number to an integer (it's like usingMath.floor
, but takes less space).I'm not 100% sure it's needed as it may happen automatically, but the number that is advertised via Bluetooth is an integer, not floating point.
If you're working on other phone software for Bluetooth LE, you could take a look at using 'Nordic UART' - I think they have posted some example code. Basically then you can send JavaScript direct to Espruino - so if you want to show something on the LEDs you can literally just send
show(0xFF)\n