How to play Star Wars sound on a piezzo (Nerdkit)
First of all you need the notes of the music you want to play with your piezzo.
I found my notes at http://tubepartitura.blogspot.co.at/ -
After that you should be able to read the notes to transfer them into Names and their Unit.
The unit of the frequency is Hertz (Hz).
You will get all frequencies from this website http://www.phy.mtu.edu/~suits/notefreqs.html -
You can download the whole program(.c and .hex files) from the download-section.
There are no images in the gallery.
void play_starwars_theme()
{
play_tone(A4, DUR*1.5);
play_tone(A4, DUR*1.5);
play_tone(A4, DUR*1.5);
play_tone(F4, DUR);
play_tone(C5, DUR*0.5);
play_tone(A4, DUR*1.5);
play_tone(F4, DUR);
play_tone(C5, DUR*0.5);
play_tone(A4, DUR*3);
play_tone(E5, DUR*1.5);
play_tone(E5, DUR*1.5);
play_tone(E5, DUR*1.5);
play_tone(F5, DUR);
play_tone(C5, DUR*0.5);
play_tone(Gsh4, DUR*1.5);
play_tone(F4, DUR);
play_tone(C5, DUR*0.5);
play_tone(A4, DUR*3);
play_tone(A5, DUR*1.5);
play_tone(A4, DUR);
play_tone(A4, DUR*0.5);
play_tone(A5, DUR*1.5);
play_tone(Gsh5, DUR*0.75);
play_tone(G5, DUR*0.75);
play_tone(Fsh5, DUR*0.375);
play_tone(F5, DUR*0.375);
play_tone(Fsh5, DUR*0.75);
_delay_ms(250);
play_tone(Ash4, DUR*0.75);
play_tone(Dsh5, DUR*1.5);
play_tone(D5, DUR*0.75);
play_tone(Csh5, DUR*0.75);
play_tone(C5, DUR*0.375);
play_tone(B4, DUR*0.375);
play_tone(C5, DUR*0.75);
_delay_ms(250);
play_tone(F4, DUR*0.375);
play_tone(Gsh4, DUR*1.5);
play_tone(F4, DUR*1.125);
play_tone(A4, DUR*0.375);
play_tone(C5, DUR*1.5);
play_tone(A4, DUR*1.125);
play_tone(C5, DUR*0.375);
play_tone(E5, DUR*3);
play_tone(A5, DUR*1.5);
play_tone(A4, DUR);
play_tone(A4, DUR*0.5);
play_tone(A5, DUR*1.5);
play_tone(Gsh5, DUR*0.75);
play_tone(G5, DUR*0.75);
play_tone(Fsh5, DUR*0.375);
play_tone(F5, DUR*0.375);
play_tone(Fsh5, DUR*0.75);
_delay_ms(250);
play_tone(Ash4, DUR*0.75);
play_tone(Dsh5, DUR*1.5);
play_tone(D5, DUR*0.75);
play_tone(Csh5, DUR*0.75);
play_tone(C5, DUR*0.375);
play_tone(B4, DUR*0.375);
play_tone(C5, DUR*0.75);
_delay_ms(250);
play_tone(F4, DUR*0.75);
play_tone(Gsh4, DUR*1.5);
play_tone(F4, DUR*1.125);
play_tone(C5, DUR*0.375);
play_tone(A4, DUR*1.5);
play_tone(F4, DUR*1.125);
play_tone(C4, DUR*0.375);
play_tone(A4, DUR*3);
}