Musical Heartbeat - Parallel Programming
In mBlock 5, we line up the coding blocks to write a script. A maximum of 6 scripts can run at the same time.
This project consists of 2 scripts: one for the throbbing heart, the other for the music.
We need these two Neuron blocks: [Buzzer], and [LED Panel].
Script one: play music with the buzzer
1. Drag an Events block when green flag clicked to the Scripts Area. Add four Sound blocks buzzer (1) plays note () for () beats, and choose notes: C4, D4, E4, and C4.
2. Add more Sound blocks buzzer (1) plays note () for () beats as follows. Remember to use the "Duplicate" function.
3. Add a Control block forever
Script two: the throbbing heart
4. Drag an Events block when green flag clicked to the Scripts area, and then add two Looks block LED panel (1) shows image () for (1) secs.
5. Add a Control block forever
6. Click the green flag to run the program.
☛ Use the Control block forever to run the script repeatedly.