Home Micro:bit A look at the scroll:bit for the Micro:bit with some Micropython examples

A look at the scroll:bit for the Micro:bit with some Micropython examples

by shedboy71

In this article we look at the scroll:bit, this is an add on from Pimoroni which contains a lot of LEDs, in fact there are 119 in total in a 17 x 7 matrix – its controlled by an IS31FL3731 LED matrix driver chip. This is what the add on looks like plugged into a micro:bit


The board comes already assembled and you can use the makecode editor and import the pxt library into it or you can use a python library and use the mu online editor.

Parts List

Description Link
Pimoroni scroll:bit Pimoroni scroll:bit from amazon
micro:bit micro:bit from amazon

 

Code Examples

This is instructions from the archive at https://github.com/pimoroni/micropython-scrollbit

Copy the scrollbit.py file from library/scrollbit.py into your “mu_code” folder, this might be  C:\Users\YourUserName\mu_code on Windows

Create a new blank file in Mu for your project, leave it blank and Flash it to your micro:bit with the Flash button. You can close this for now.

Create another new file, save this one as “main.py” and keep it open.

Now open the “Files” dialog (you might have to close the “Repl” first) and drag and drop main.py and scrollbit.py from the right pane, to the left pane.

When you reset your micro:bit, it will load main.py- so you can “import scrollbit” and start writing your code here!

This are some default examples

[codesyntax lang=”python”]

import scrollbit

scrollbit.scroll("Hello World!")
scrollbit.orientation = scrollbit.INVERT
scrollbit.scroll(" {HEART} {DIAMOND} ")

[/codesyntax]

The following icons can be used

HEART, HEART_SMALL, HAPPY, SMILE, SAD, CONFUSED, ANGRY, ASLEEP, SURPRISED, SILLY, FABULOUS, MEH, YES, NO, CLOCK12, CLOCK1, CLOCK2, CLOCK3, CLOCK4, CLOCK5, CLOCK6, CLOCK7, CLOCK8, CLOCK9, CLOCK10, CLOCK11, ARROW_N, ARROW_NE, ARROW_E, ARROW_SE, ARROW_S, ARROW_SW, ARROW_W, ARROW_NW, TRIANGLE, TRIANGLE_LEFT, CHESSBOARD, DIAMOND, DIAMOND_SMALL, SQUARE, SQUARE_SMALL, RABBIT, COW, MUSIC_CROTCHET, MUSIC_QUAVER, MUSIC_QUAVERS, PITCHFORK, XMAS, PACMAN, TARGET, ALL_CLOCKS, ALL_ARROWS, TSHIRT, ROLLERSKATE, DUCK, HOUSE, TORTOISE, BUTTERFLY, STICKFIGURE, GHOST, SWORD, GIRAFFE, SKULL, UMBRELLA and SNAKE

This is sort of liek a magic 8 ball type example

[codesyntax lang=”python”]

import random
import scrollbit
import microbit

phrases = ["Yes", "No", "Maybe", "Go for it", "Sounds good", "Superb"]

while True:
    if microbit.button_a.was_pressed():
        try:
            scrollbit.scroll(random.choice(phrases))
        except:
            print(random.choice(phrases))
    microbit.sleep(100)

[/codesyntax]

You may also like

Leave a Comment