Students are able to learn event-based programming and use buttons and music as event triggers.
Students are able to produce projects that emit light and sound when triggered by an event.
Event-triggered programs.
Example of an event-based programming flow chart.
Example of an event block.
Materials and components that are needed:
micro: bit + USB wire + buzzer + 2 alligator clips
Computer
Visit makecode.microbit.org
Color paper + cardboard
Transcript
"Baa, Baa, Black Sheep" Music Note
C C G G
Baa, baa, black sheep
A A A-A G
Have you any wool?
F F E E
Yes sir, yes sir
D D C
Three bags full!
G G G F - F
One for the master
E E E D
One for the dame
C G G G F-F F
And one for the little boy
F E E E D
Who lives down the lane!
"Mary had a little lamb" Music Note
A - G F G A-A A
Mary had a little lamb
G - G G A-^C ^C
Little lamb, little lamb
A - G F G A-A A
Mary had a little lamb
A G G A G F
Its fleece was white as snow
F A - G - F G A - A A
And everywhere that Mary went
G - G G A-^C ^C
Mary went, Mary went
A - G - F G A-A A
Everywhere that Mary went
A G G A G F
The lamb was sure to go!
Play the music “wa wa wa wa” when the A button is pressed.
Play the song “Baa, Baa, Black Sheep” or “Mary had a little lamb” when one of the buttons is pressed.
Use music as an event trigger. Music can trigger icons or messages to be displayed or light up LEDs in external circuits.
👉CLICK HERE👈 to try it on makecode.
Ways to build the code.
End product.
The gif on the side shows how to copy program blocks.
Classroom exhibition
Combine Challenge 1 (play the full song) with Challenge 2 (use music as an event trigger).
Use your creativity to make an exciting project that includes both!