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: DebouncedIn mbed
Revision 3:56ef196dd001, committed 2014-04-27
- Comitter:
- juanmglopez
- Date:
- Sun Apr 27 00:20:08 2014 +0000
- Parent:
- 2:a6945fdfc6dd
- Commit message:
- actualizaci?n de sonidos
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Sat Apr 26 22:55:19 2014 +0000 +++ b/main.cpp Sun Apr 27 00:20:08 2014 +0000 @@ -10,8 +10,31 @@ DebouncedIn mybutton2(PTC13); DebouncedIn mybutton3(PTC16); DigitalOut myled(LED1); // En este caso LED1 se refiere al LED AZUL. +PwmOut Pwm(PTA5); float inc = 0.001; // Se establece un retardo inicial de 1 ms. +float p1 = 0.001; + +int PWMmodule(float p1) +{ + Pwm.period(p1); + Pwm.write(0.1); + wait(0.1); + Pwm.write(1); + wait(0.1); + Pwm.write(0.5); + wait(0.1); + Pwm.write(2); + wait(0.1); + Pwm.write(0.01); + wait(0.1); + Pwm.write(0.001); + wait(0.1); + Pwm.write(0); + return 0; +} + + int main() // Función que define la sucesión entre los diferentes estados del LED { @@ -19,14 +42,25 @@ if (mybutton1.falling()) { inc += 0.01; + PWMmodule(p1); } - if (mybutton2.falling() && inc != 0.001) + if (mybutton2.falling() && inc != 0.001) //Revisar fallo al hundir este botón de primero. { - inc -= 0.01; + inc -= 0.01; + PWMmodule(p1); } if (mybutton3.falling() && inc != 0.001) { inc = 0.001; + PWMmodule(p1); + } + if (mybutton2.falling() && inc == 0.001) + { + //inc = inc; + } + if (mybutton3.falling() && inc == 0.001) + { + //inc = inc; } myled = !myled; wait(inc);