Discover Arduino Projects
Hundreds of projects from beginner to advanced — schematics, code, and videos.

First Melody with mBot: Play Notes on the Buzzer
The buzzer on the mBot's board plays the first two lines of a well-known children's song (Twinkle Twinkle Little Star), waits 2 seconds and starts over. No extra parts are needed. Every note is a frequency (Hz) and a length; the melody lives in two lists, one with the notes and one with the beat counts. The tone command plays a note and waits until it is over.

mBot Melody Picker: Press the Button, Change the Tune
Every press of the button on the mBot's board makes the buzzer play the next melody. There are three short melodies; after the third it goes back to the first. No extra parts are needed. The melodies live in one table: one melody per row, eight beats each. Pressing the button while a melody plays changes nothing, because tone holds the code until the note is over.
