Microbit

From PrattWiki
Revision as of 17:15, 2 June 2022 by DukeEgr93 (talk | contribs) (Created page with "This is most definitely a sandbox page for the micro:bit! == Links == Links first? What? * [https://microbit.org/ micro:bit educational foundation] == Installation == * [ht...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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)

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)