Micro:bit basic example won't run

Posted on
  • Hey everyone! First post here for me. I could use some help. :)

    I just flashed my BBC micro:bit with espruino_2v06_microbit.hex (the latest "stable"), then connected in the web IDE via Bluetooth. (I'm coding on a Macbook Air, Catalina, in Chrome 84.0.4147.105.) So far so good. But when I run the even the simplest line of code, like this...

    LED1.write(true);
    

    ...I get the following error in the Espruino console:

    Uncaught ReferenceError: "LED1" is not defined

    When I refresh the web IDE and look in the Espruino console, I see this error:

    Uncaught InternalError: I2C Write Error 33281

    So I'm assuming that LED1 isn't defined because some earlier I2C error is breaking things. Any ideas for what might be going on? I also tried the "cutting edge" hex and got the same results.

    Probably unrelated, but in the Chrome JS console, I get this error when the IDE loads up:

    settingsConsole.js:40 serial_frame: getPorts timeout, disabling

    I hope I can make Espruino work on the micro:bit. Looks like a really great platform. Thanks for any advice you have.

    UPDATE:
    So, it turns out that the LED1 variable just isn't set, but other commands are working fine so far. Like the show() command and the example on the micro:bit page about buttons. So... I think it was a false alarm.

    It would be nice to report the i2C write error bug and add a feature request that the IDE should load with an example that works on the Micro:bit. I will now look for how to report those... Thanks!

  • Hi,

    The LED1 issue is because the micro:bit only has the grid of lights, not a specific LED. You could actually work around it with global.LED1={write:function(x){show(x?1:­0)}}; - which will create a 'fake' LED that turns one LED on the LED matrix on and off.

    I'll see about adding that to the micro:bit build.

    As it says at the top of https://www.espruino.com/MicroBit you'll need a 'cutting edge' build of Espruino. The micro:bit itself changed in version 1.5 and they used different sensors (hence the i2c error). 2v06 doesn't have a fix in, but if you use the most up to date builds (or 2v07 when it's released) then it's sorted and you'll be able to use magnetometer & accelerometer again.

    settingsConsole.js:40 serial_frame: getPorts timeout, disabling

    Yes - actually that's something that got fixed a few days ago but hasn't been put live yet. Either way it's nothing to worry about.

  • Great, thanks for the help!

  • Ok, if you try a 'cutting edge' build there's now an LED/LED1 pin. I also managed to re-add the tab complete, because that makes it way more fun to use the REPL :)

  • Thank you!

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Micro:bit basic example won't run

Posted by Avatar for ScottLininger @ScottLininger

Actions