Se implementa un retardo con un botón externo en el LED RGB
Dependencies: DebouncedIn mbed
Revision 0:a4e123b35c53, committed 2014-03-27
- Comitter:
- juanmglopez
- Date:
- Thu Mar 27 04:36:09 2014 +0000
- Commit message:
- Delay button in led RGB
Changed in this revision
diff -r 000000000000 -r a4e123b35c53 DebouncedIn.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/DebouncedIn.lib Thu Mar 27 04:36:09 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/cmorab/code/DebouncedIn/#dc1131de43e8
diff -r 000000000000 -r a4e123b35c53 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Mar 27 04:36:09 2014 +0000 @@ -0,0 +1,22 @@ +#include "mbed.h" +#include "DebouncedIn.h" + + // Johana Cano Vélez + // Juan Manuel Gómez + +DebouncedIn mybutton(PTC12); // Utilizando la librería de mbded el program funciona bastante bien con el puerto PTD6, sin embargo con la libreria DebouncedIn es recomendable usar un puerto PTC +DigitalOut myled(LED1); // En este caso LED1 se refiere al LED AZUL. + +float delay = 0.001; // Se establece un retardo inicial de 1 ms. + +int main() // Función que define la sucesión entre los diferentes estados del LED +{ + while (1) { + if (mybutton.falling()) + { + delay += 0.01; + } + myled = !myled; + wait(delay); + } +} \ No newline at end of file
diff -r 000000000000 -r a4e123b35c53 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Thu Mar 27 04:36:09 2014 +0000 @@ -0,0 +1,1 @@ +http://world3.dev.mbed.org/users/mbed_official/code/mbed/builds/824293ae5e43 \ No newline at end of file