Bhavithiran
Published © MIT

Program micro:bit mobile robot with Python | 2 Play Music

A step by step guide to program a micro:bit mobile robot to play music using MicroPython

BeginnerProtip30 minutes208
Program micro:bit mobile robot with Python | 2 Play Music

Things used in this project

Hardware components

Cytron Technologies rero:micro
×1

Software apps and online services

Mu
Python Editor for micro:bit

Story

Read more

Code

Play Music

Python
This tutorial's full code
from reromicro import *
import music

rero = reromicro()

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"]

while True:
    if button_a.was_pressed():
        music.play(tune)
    elif button_b.was_pressed():
        music.play(music.NYAN)

Credits

Bhavithiran

Bhavithiran

15 projects • 4 followers

Comments