Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of song_demo_PWM by
main.cpp
00001 // miniblip play notes with interrupts - Not tested with led matrix 00002 // For documentation see http://mbed.org/users/4180_1/notebook/using-a-speaker-for-audio-output/ 00003 00004 #include "mbed.h" 00005 #include "SongPlayer.h" 00006 00007 //Set up notes and durations for sample song to play 00008 // A 0.0 duration note at end terminates song play 00009 float note[18]= {1568.0,1396.9,1244.5,1244.5,1396.9,1568.0,1568.0,1568.0,1396.9, 00010 1244.5,1396.9,1568.0,1396.9,1244.5,1174.7,1244.5,1244.5, 0.0 00011 }; 00012 float duration[18]= {0.48,0.24,0.72,0.48,0.24,0.48,0.24,0.24,0.24, 00013 0.24,0.24,0.24,0.24,0.48,0.24,0.48,0.48, 0.0 00014 }; 00015 00016 int main() 00017 { 00018 // Buzzer pin 00019 SongPlayer mySpeaker(P0_8); 00020 // Start song and return once playing starts 00021 mySpeaker.PlaySong(note,duration); 00022 // loops forever while song continues to play to end using interrupts 00023 while(1) { 00024 wait(.1); 00025 } 00026 } 00027
Generated on Fri Jul 15 2022 02:20:00 by
1.7.2
