Pablo Clemente
/
blip_playnotes
updated blip_playnotes with notes.h
Fork of blip_playnotes by
main.cpp
- Committer:
- paclema
- Date:
- 2015-11-30
- Revision:
- 4:e80a13a4e8eb
- Parent:
- 3:a6355b9de221
File content as of revision 4:e80a13a4e8eb:
// miniblip play notes with interrupts - Not tested with led matrix // For documentation see http://mbed.org/users/4180_1/notebook/using-a-speaker-for-audio-output/ #include "mbed.h" #include "SongPlayer.h" #include "notes.h" //Set up notes and durations for sample song to play // A 0.0 duration note at end terminates song play float note[18]= {1568.0,1396.9,1244.5,1244.5,1396.9,1568.0,1568.0,1568.0,1396.9, 1244.5,1396.9,1568.0,1396.9,1244.5,1174.7,1244.5,1244.5, 0.0 }; float duration[32]= {0.48,0.24,0.72,0.48,0.24,0.48,0.24,0.24,0.24, 0.24,0.24,0.24,0.24,0.48,0.24,0.48,0.48, 0.0, 0.48,0.24,0.72,0.48,0.24,0.48,0.24,0.24,0.24, 0.24,0.24,0.24 }; //Mario main theme melody float melody[32] = { NOTE_E7, NOTE_E7, 0, NOTE_E7, 0, NOTE_C7, NOTE_E7, 0, NOTE_G7, 0, 0, 0, NOTE_G6, 0, 0, 0, }; //Mario main them tempo float tempo[] = { 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 9, 9, 9, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 9, 9, 9, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, }; int main() { // Buzzer pin SongPlayer mySpeaker(P0_8); // Start song and return once playing starts //mySpeaker.PlaySong(note,duration); mySpeaker.PlaySong(melody,duration); // loops forever while song continues to play to end using interrupts while(1) { wait(.1); } }