-
• #2
No problem - actually Ruuvi were really good, and have paid me to port Espruino over and to keep producing binaries for them (1v92 will be in the Espruino binary zip file)
Unfortunately it's a tricky one - the LEDs and Buttons on Ruuvitag really are upside-down. I'm afraid there's no obvious fix, since in Espruino LED1 refers to the actual pin on the chip - so if you write 1 to it, it outputs 1. Changing that would require some pretty far-reaching modifications.
I'd have to add code to optionally invert specific pins, which would probably end up being really confusing if you tried to access the pin directly, and would definitely slow things down. I think for now that's just something you'll have to live with.
-
• #3
Thank you for your explanation.
-
• #4
Good thing that things like the
Puck
object andPuck.light()
aren't yet implemented on RuuviTag (right?), since they make assumptions about how on and off are mapped to1
and0
. One way to mitigate these would be to abstract them:
LED1.write(ledOn);
LED1.write(ledOff);
var buttonState = buttonPressed();
… where
ledOn
,ledOff
, andbuttonPressed()
are mapped to1
or0
in platform specific ways.But those don't solve the problem of running existing Espruino JS apps on RuuviTag. Maybe the IDE could spot things like
LED1
andBTN
, and in the case of RuuviTag, tag the line with an informational icon (not quite a warning).…… answer = 42;
💡 btnOn = digitalRead(BTN);
…… console.log(btnOn);
Thanks for porting Espruino to the RuuviTag! I was looking forward to doing it myself but this works for me to :-).
However, it looks like the LEDs and BTN are low-active:
Not a big issue, can it be fixed?