LED Matrix

the LED matrix is a 25-LED multiplexed array. You can't just set the LED's on or off, they must be scanned through continuously to keep them lit. To make this easy for you we've added support to the Adafruit_Microbit library - it even uses a timer (Timer 2) to manage all the multiplexing for you.

First up, install the Adafruit helper libraries

Open up the matrixdemo sketch and upload it to  your bit

The library manages all the refreshing, the drawing routines are all handled by Adafruit_GFX which we have documented in detail here https://learn.adafruit.com/adafruit-gfx-graphics-library/

Note that the screen is small so even though the GFX library can do a lot, there's not a ton of space for complex shapes. We do have a small and simple font you can use that will fit in the 5-pixel-tall display, called TomThumb.h

  // setup font for later!

To scroll text you'll need to set the cursor 'outside' the 5x5 boundary, like so:

  // scroll some text
  String myMessage = "HELLO WORLD";
  for (int i = 5; i > (((int)myMessage.length()-1) * -5) ; i--) {
    microbit.setCursor(i, 5);

For bitmaps, the screen is 5x5 but to make the math easier on everyone, you can store bitmaps in 8-bit-wide structures and just ignore the right-most 3 bits in each 8-bit word:

  smile_bmp[] =
  { B00000000,
    B01110000, };
Last updated on 2017-09-27 at 01.05.00 PM Published on 2017-09-27 at 01.15.13 PM