Good thing that things like the Puck object and Puck.light() aren't yet implemented on RuuviTag (right?), since they make assumptions about how on and off are mapped to 1 and 0. One way to mitigate these would be to abstract them: LED1.write(ledOn); LED1.write(ledOff); var buttonState = buttonPressed();
… where ledOn, ledOff, and buttonPressed() are mapped to 1 or 0 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 and BTN, and in the case of RuuviTag, tag the line with an informational icon (not quite a warning).
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.
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);