supermario theme
Dependencies: PWM_Tone_Library mbed
Fork of PiezoBuzzer_HelloWorld_WIZwiki-W7500 by
Diff: main.cpp
- Revision:
- 1:34d5ad7e2cf4
- Parent:
- 0:9d311e74ad13
--- a/main.cpp Fri Jul 24 05:12:14 2015 +0000 +++ b/main.cpp Wed Nov 30 17:22:37 2016 +0000 @@ -7,7 +7,8 @@ /* Private variables ---------------------------------------------------------*/ PwmOut Buzzer(D5); -float C_3 = 1000000/Do3, +float + C_3 = 1000000/Do3, Cs_3 = 1000000/Do3s, D_3 = 1000000/Re3, Ds_3 = 1000000/Re3s, @@ -44,9 +45,9 @@ As_5 = 1000000/La5s, B_5 = 1000000/Ti5; -int tones[] = {E_4, D_4, C_4, D_4, E_4, E_4, E_4, 0, D_4, D_4, D_4, 0, E_4, G_4, G_4, 0, - E_4, D_4, C_4, D_4, E_4, E_4, E_4, 0, D_4, D_4, E_4, D_4, C_4, 0, 0, 0}; -int tones_num = 32; + + int tones[] = {E_4, E_4, 0, E_4, 0, C_4, E_5,0, G_5, 0, 0, 0, G_4}; +int tones_num = 13; /* Private functions ---------------------------------------------------------*/ /** @@ -56,18 +57,12 @@ */ int main(void) { - Tune(Buzzer, C_4, 4); //4 Octave C beat 4/16 - wait_ms(250); - Tune(Buzzer, D_4, 4); //4 Octave D beat 4/16 - wait_ms(250); - Tune(Buzzer, E_4, 4); //4 Octave E beat 4/16 - wait_ms(250); - + int i; for(i=0; i<tones_num; i++) { - Auto_tunes(Buzzer, tones[i], 4); // Auto performance + Auto_tunes(Buzzer, tones[i], 2); // Auto performance Stop_tunes(Buzzer); } } \ No newline at end of file