Home CodeJavaScript Microbit and Espruino firmware

Microbit and Espruino firmware

by shedboy71

I bought an Espruino board  while back because it allowed you to code in JavaScript using a neat chrome add on – a web ide and then flash your device directly. I was also intrigued to se that there was firmware for other boards such as the Micro:bit.

Download the Espruino firmware from http://www.espruino.com/Download . The download is a zip file with support for many platforms, extract it on your PC and locate the microbit hex file, my version was 1.87 so it was called espruino_1v87_microbit.hex.

To flash onto your micro:bit:

  • Plug your Micro:bit into your PC. A drive called MICROBIT should appear
  • Copy the .hex file for Espruino to the root of that drive
  • The yellow LED on the micro:bit will blink quickly for a few seconds
  • The Espruino firmware is now installed

There is an online IDE and if you have Google Chrome and an app that can be added – Espruino Web IDE . I use Chrome so the latter is what I use.

Code Examples

Display a message if a button is pressed in the IDE console

[codesyntax lang=”javascript”]

setWatch(function() {
  console.log("Button 1 Pressed");
}, BTN1, {repeat:true, debounce:20, edge:"falling"});

[/codesyntax]

Press the button and you should see something like this

Button 1 Pressed
Button 1 Pressed
Button 1 Pressed
Button 1 Pressed
>

Now to scroll some text on the Micro:bit leds

[codesyntax lang=”javascript”]

g = Graphics.createArrayBuffer(5,5,1);
g.flip = function(){show(this.buffer);};

var x = 0;
setInterval(function() 
{
  x++;
  if (x>50)x=0;
  g.clear();
  g.drawString("Microbit",5-x);
  g.flip();
}, 150);

[/codesyntax]

You may also like

Leave a Comment