Saturday, 30 July 2016

Got my Micro:bit

I received my BBC Micro:bit this morning. Here's one of the first programs I tried out:

Using the Micropython editor "Mu" which runs on all platforms, edits code, and flashes the micro:bit directly - very easy and efficient... A note I should mention is that Micropython runtime is downloaded to the micro:bit along with your program when you "Flash".

Screen Shot 2016 07 30 at 12 23 42

Code

from microbit import *

while True:
    reading = accelerometer.get_y()
    if reading > 400:
        display.show(Image.HAPPY)
    else:
        display.show(Image.SAD)


Resulting in two images on the micro:bit:

IMG 0125

and when you tip it up:

IMG 0126

No comments: