CodeBug can play music from it’s legs, when connected to a buzzer or speakers, with just a few simple blocks.
First you need to set leg 0 into music mode.
Click the blue cog on the start block and tick the checkbox next to leg 0 input/output, click the cog again to close this window.
Now click the leg 0 drop down that has appeared on the start block and select music (PWM) output.
For our tune to sound right, we need to set the beat (tempo).
You will want your tune to loop so it will play again and again.
Now you can create your tune.
From the Music menu, drag in 8 play tone blocks and snap them one after the other inside your repeat while loop.
Click on the letter drop downs in your play tone blocks and change the letters so they read C for the first block, D for the second then E, F, G, A, B, C7.
Click play on the emulator and make sure your computer speakers are turned on.
You should be able to hear your tune. This is the scale of C!