Microbit

From PrattWiki
Jump to navigation Jump to search

This is most definitely a sandbox page for the micro:bit!

Links

Links first? What?

Installation

Python

  • Can run from web page, but needs Chrome versus other browsers.

Commands

  • from microbit import *
    • Imports all commands (note: may want to use prefixes at some point!)
  • display.scroll(STR)
    • Scrolls text across 5x5 LCD array
  • display.show(Image.IMG)
  • sleep(MSEC)
    • Pauses for the specified number of microseconds

Samples

Hour hand rotation

from microbit import *

while True:
    for k in range(12):
        cmd = "display.show(Image.CLOCK{:0.0f})".format(k+1)
        print(cmd)
        exec(cmd)
        sleep(200)