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.
Dependencies: mbed
Fork of song_demo_PWM by
main.cpp
00001 #include "mbed.h" 00002 #include "tones.h" 00003 #include "SongPlayer.h" 00004 // I apologize in advance for this fucking mess of a code 00005 // Update: it's slightly less of a mess right now! :D 00006 00007 DigitalIn input(A4); 00008 SongPlayer mySpeaker(A5); 00009 Timer songTimer; 00010 Timer deathTimer; 00011 bool deathbool = false; 00012 00013 void death() 00014 { 00015 deathTimer.reset(); 00016 mySpeaker.PlaySong(note_death,duration_death); 00017 } 00018 00019 00020 int main() 00021 { 00022 songTimer.start(); 00023 deathTimer.start(); 00024 mySpeaker.PlaySong(note,duration); 00025 while(1) 00026 { 00027 if(input == 0) 00028 { 00029 keepplaying = true; 00030 } 00031 else 00032 { 00033 //keepplaying = false; commented out for now 00034 } 00035 if(input == 1 and deathTimer.read() > 4) 00036 { 00037 death(); 00038 00039 } 00040 if(songTimer.read() > 15) 00041 { 00042 songTimer.reset(); 00043 mySpeaker.PlaySong(note,duration); 00044 } 00045 wait(.1); 00046 } 00047 } 00048
Generated on Thu Jul 14 2022 21:01:01 by
1.7.2
