Jammin'

By Eunchae Kim

Description of Jammin’ Project: This code plays Twinkle, Twinkle, Little Star when the switch is on and stops playing when the switch is off.

I chose Twinkle, Twinkle, Little Star because I wanted to choose a recognizable and yet joyous tune. I used the song’s melody and found the note frequencies online. I then used the examples from our COMP 103 buzzer slides to write Arduino code that plays each note for a specific duration using tone(), delay(), and noTone(). I put the music code inside loop() so the song repeats continuously instead of playing only once.

Tip: A tip I would give my past self is to test the buzzer with just a few notes before writing out the entire song. This makes it easier to catch mistakes in the pin connections or note frequencies early, rather than having to troubleshoot the whole song at once.