Jurica Resetar
/
acd52832_buzzer
acd52832_buzzer example
main.cpp@0:c20182d53ef0, 2016-09-20 (annotated)
- Committer:
- jurica238814
- Date:
- Tue Sep 20 10:11:25 2016 +0000
- Revision:
- 0:c20182d53ef0
acd52832_buzzer;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jurica238814 | 0:c20182d53ef0 | 1 | |
jurica238814 | 0:c20182d53ef0 | 2 | |
jurica238814 | 0:c20182d53ef0 | 3 | |
jurica238814 | 0:c20182d53ef0 | 4 | #include "mbed.h" |
jurica238814 | 0:c20182d53ef0 | 5 | #include "Buzzer.h" |
jurica238814 | 0:c20182d53ef0 | 6 | |
jurica238814 | 0:c20182d53ef0 | 7 | //char *song = "The Simpsons:d=4,o=5,b=160:c.6,e6,f#6,8a6,g.6,e6,c6,8a,8f#,8f#,8f#,2g,8p,8p,8f#,8f#,8f#,8g,a#.,8c6,8c6,8c6,c6"; |
jurica238814 | 0:c20182d53ef0 | 8 | //char *song = "Xfiles:d=4,o=5,b=125:e,b,a,b,d6,2b.,1p,e,b,a,b,e6,2b.,1p,g6,f#6,e6,d6,e6,2b.,1p,g6,f#6,e6,d6,f#6,2b.,1p,e,b,a,b,d6,2b.,1p,e,b,a,b,e6,2b.,1p,e6,2b."; |
jurica238814 | 0:c20182d53ef0 | 9 | char *song = "smb:d=4,o=5,b=100:16e6,16e6,32p,8e6,16c6,8e6,8g6,8p,8g,8p,8c6,16p,8g,16p,8e,16p,8a,8b,16a#,8a,16g.,16e6,16g6,8a6,16f6,8g6,8e6,16c6,16d6,8b,16p,8c6,16p,8g,16p,8e,16p,8a,8b,16a#,8a,16g.,16e6,16g6,8a6,16f6,8g6,8e6,16c6,16d6,8b,8p,16g6,16f#6,16f6,16d#6,16p,16e6,16p,16g#,16a,16c6,16p,16a,16c6,16d6,8p,16g6,16f#6,16f6,16d#6,16p,16e6,16p,16c7,16p,16c7,16c7,p,16g6,16f#6,16f6,16d#6,16p,16e6,16p,16g#,16a,16c6,16p,16a,16c6,16d6,8p,16d#6,8p,16d6,8p,16c6"; |
jurica238814 | 0:c20182d53ef0 | 10 | |
jurica238814 | 0:c20182d53ef0 | 11 | Buzzer buzzer(p31); |
jurica238814 | 0:c20182d53ef0 | 12 | |
jurica238814 | 0:c20182d53ef0 | 13 | Music* pMusic=0; //the song |
jurica238814 | 0:c20182d53ef0 | 14 | Note la("A#4",50); //the sound |
jurica238814 | 0:c20182d53ef0 | 15 | |
jurica238814 | 0:c20182d53ef0 | 16 | int main() |
jurica238814 | 0:c20182d53ef0 | 17 | { |
jurica238814 | 0:c20182d53ef0 | 18 | pMusic= new Music(song); |
jurica238814 | 0:c20182d53ef0 | 19 | pMusic->play(&buzzer); |
jurica238814 | 0:c20182d53ef0 | 20 | |
jurica238814 | 0:c20182d53ef0 | 21 | buzzer.tone(&la); |
jurica238814 | 0:c20182d53ef0 | 22 | delete(pMusic); |
jurica238814 | 0:c20182d53ef0 | 23 | } |