BBC micro:bit Bird Activity GitHub

MicroPython on the BBC micro:bit

Python is possible in the micro:bit thanks to Damien George’s MicroPython, and all of its contributors (one, two, three). For a history of how this came to be, Nicholas Tollervey also has a great post on his blog: The Story of MicroPython on the BBC micro:bit

MicroPython comic

These are useful links to find out how to use MicroPython on the micro:bit:

SoundEffect Information:

The micro:bit V2 MicroPython repository: https://github.com/microbit-foundation/micropython-microbit-v2

Quick things to do with the micro:bit

To “Reference” left side bar in the editor is the best place to find out more about the micro:bit features in MicroPython. But for a quick , these are a couple of quick snippets that output sound or images.

Display one of the built-in images (more info here):

from microbit import *

display.show(Image.HAPPY)

Play one of the built-in sounds (full list here):

from microbit import *

audio.play(Sound.HAPPY)

Play one of the built-in music tunes:

import music

music.play(music.BIRTHDAY)

Make your own music tune (more info here):

import music

tune = ["C4:4", "D4:4", "E4:4", "C4:4", "C4:4", "D4:4", "E4:4", "C4:4",
        "E4:4", "F4:4", "G4:8", "E4:4", "F4:4", "G4:8"]
music.play(tune)

Speak (more info here):

import speech

speech.say("Hello, World")

Create your own sounds!

More info here: Preview of the proposal for the SoundEffect documentation

from microbit import *
audio.play(audio.SoundEffect(
    freq_start=400,
    freq_end=2000,
    duration=500,
    vol_start=100,
    vol_end=255,
    waveform=audio.SoundEffect.WAVEFORM_TRIANGLE,
    fx=audio.SoundEffect.FX_VIBRATO,
    shape=audio.SoundEffect.SHAPE_LOG
))