Music Box | Boson starter for micro:bit 08

0 3993 Easy
projectImage
projectImage
projectImage
projectImage

STEP1: connect micro: bit board to computer with USB cable, plug the earphone in the expansion board; connect the motion sensor to pin P1 of the expansion board.

projectImage
projectImage

STEP2: Programming

1. Drag “pin P0 play sound…until done” block from “micro: bit” module to script area. There are many built-in sounds to choose. We select the sound “dadadadum” here.

projectImage

2. Run the program

projectImage
projectImage

1. Program to generate a piece of music of Twinkle, Twinkle, Little Star.

projectImage
projectImage

2. Drag “pin P0 play note-C2 for 1beat” from the “micro: bit” module to script area. Revise the parameter “C2” to play different notes, and change the parameter ”1” to adjust the beat.

projectImage

3. Motion sensor has been connected to pin P1, if someone passes near the device, the value of P1 will be 1, otherwise, it will be 0. Therefore, combining it a “if then…else” statement, we can make the smart music box come to life.

projectImage
projectImage
License
All Rights
Reserved
licensBg
0