TISPY Original FW
Dependencies: PWM_Tone_Library mbed
Fork of PiezoBuzzer_HelloWorld_WIZwiki-W7500 by
Revision 1:34e47981bf27, committed 2017-02-19
- Comitter:
- mihanada
- Date:
- Sun Feb 19 05:30:37 2017 +0000
- Parent:
- 0:9d311e74ad13
- Commit message:
- 1st relees
Changed in this revision
diff -r 9d311e74ad13 -r 34e47981bf27 PWM_Tone_Library.lib --- a/PWM_Tone_Library.lib Fri Jul 24 05:12:14 2015 +0000 +++ b/PWM_Tone_Library.lib Sun Feb 19 05:30:37 2017 +0000 @@ -1,1 +1,1 @@ -http://developer.mbed.org/users/justinkim/code/PWM_Tone_Library/#d06af372d384 +http://developer.mbed.org/users/justinkim/code/PWM_Tone_Library/#4b841d62e529
diff -r 9d311e74ad13 -r 34e47981bf27 main.cpp --- a/main.cpp Fri Jul 24 05:12:14 2015 +0000 +++ b/main.cpp Sun Feb 19 05:30:37 2017 +0000 @@ -5,7 +5,9 @@ /* Private typedef -----------------------------------------------------------*/ /* Private define ------------------------------------------------------------*/ /* Private variables ---------------------------------------------------------*/ -PwmOut Buzzer(D5); +PwmOut Buzzer(P1_23); +DigitalOut myled0(P0_21); +InterruptIn button(P0_1); float C_3 = 1000000/Do3, Cs_3 = 1000000/Do3s, @@ -14,6 +16,7 @@ E_3 = 1000000/Mi3, F_3 = 1000000/Fa3, Fs_3 = 1000000/Fa3s, + Mi_3 = 1000000/Mi3, G_3 = 1000000/So3, Gs_3 = 1000000/So3s, A_3 = 1000000/La3, @@ -44,8 +47,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[] = {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; /* Private functions ---------------------------------------------------------*/ @@ -54,20 +58,46 @@ * @param None * @retval None */ -int main(void) -{ + +void melo() { + myled0 = 0; + /* 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 Stop_tunes(Buzzer); } + myled0 = 1; + } + + + +int main(void) +{ + button.rise(&melo); + myled0 = 0; + Tune(Buzzer, C_4, 1); + myled0 = 1; + wait_ms(100); + myled0 = 0; + wait_ms(100); + myled0 = 1; + wait_ms(100); + myled0 = 0; + wait_ms(100); + myled0 = 1; + wait_ms(100); + myled0 = 0; + wait_ms(100); + myled0 = 1; + sleep(); } \ No newline at end of file
diff -r 9d311e74ad13 -r 34e47981bf27 mbed.bld --- a/mbed.bld Fri Jul 24 05:12:14 2015 +0000 +++ b/mbed.bld Sun Feb 19 05:30:37 2017 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/mbed/builds/bad568076d81 \ No newline at end of file +http://mbed.org/users/mbed_official/code/mbed/builds/ef9c61f8c49f \ No newline at end of file