rero:micro is a child-friendly robot kit using micro:bit that is specially designed to encourage young children to learn coding in a fun and easy manner.
MicroPython is an open source Python programming language interpretor that runs on small embedded development boards.
rero:micro has a built-in piezzo buzzer connected to micro:bit's P0.
This is the second lesson (PlayMusic) for this series. Check out the other lessons in the links below:
- Program micro:bit mobile robot with Python | 1 Colour Splash
- Program micro:bit mobile robot with Python | 3 Move Around
- Program micro:bit mobile robot with Python | 4 Detect Object
- Program micro:bit mobile robot with Python | 5 Line Follow
Check out the first lesson (Colour Splash) for the guidelines to setup the software.
PLAY MUSICCODING
To program the rero:micro you need to add these code:
from reromicro import *
rero = reromicro()
To access Music
module you need to add these code:
import music
MicroPython has quite a lot of built-in melodies, find out more information here: https://microbit-micropython.readthedocs.io/en/latest/tutorials/music.html
A simple program to play built-in melodies:
from reromicro import *
import music
rero = reromicro()
music.play(music.NYAN)
User also can create their own tune, find out more information here: https://microbit-micropython.readthedocs.io/en/latest/music.html
An example program to create your own tune:
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"]
music.play(tune)
This is the opening tune of “Frere Jaques”
UPLOAD
Check out the first lesson (Colour Splash) for the guidelines to upload program to rero:micro
LINK FOR THE NEXT LESSON - Program micro:bit mobile robot with Python | 3 Move Around
Comments