Astronomia (Coffin Meme) Tune on Arduino

Astronomia (Coffin Meme) Tune on Arduino

Circuit Diagram

Addicted to the viral Coffin Meme tune? Want to play it on an Arduino and use it in your projects? Here's how.

You only need two components: an Arduino and a Buzzer (and some jumper wires).

Video tutorial:

Connection Diagram:

Code Explanation

Code can be downloaded from

Includes “pitches.h” in the code (download from GitHub link above and place in the same folder as the .ino file), which contains frequencies of various musical notes which we will need to play the tune. Sets buzzer pin to 8, and button pin to 5.

Looptune is the number of times you want the tune to repeat after pressing the button. It can only be a positive integer.

Imports the frequencies of the notes we will be needing from “pitches.h” and stores them in an array named melody.

Configures the button pin to receive input by pulling it high. Multiplies looptune by 72, which is the number of musical notes in the melody array.

Checks if button is pressed. If yes, plays tune twice (looptune number of times) using the tone function.

Leave a Reply

Your email address will not be published.

Pin It on Pinterest

Share This