Tarea1-Versión3. Uso de 3 botones, al presionar el botón 1 el tiempo de encendido y apagado del LED disminuye, al presionar el botón 2 el tiempo de encendido y apagado del LED aumenta, al presionar el botón 3 se lleva el LED a un estado inicial (Reset)
Fork of Tarea1-V3 by
Revision 0:f8fe2133f19c, committed 2014-04-08
- Comitter:
- juniorACA
- Date:
- Tue Apr 08 17:42:09 2014 +0000
- Commit message:
- Tarea1-V3
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Debounced.lib Tue Apr 08 17:42:09 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/WarwickRacing/code/Debounced/#8992c13bbb9b
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Tue Apr 08 17:42:09 2014 +0000 @@ -0,0 +1,36 @@ + +#include "mbed.h" +#include "DebouncedIn.h" + +DebouncedIn puls1(PTC12); +DebouncedIn puls2(PTC13); +DebouncedIn puls3(PTC16); +DigitalOut myled(LED1); + +float k=0; +float t=0.01; +float r=0; + +int main() { + while(1) { + if(puls1.falling()){ + ++k; + t=0.01*(k*1.1); + } + myled = !myled; + wait(t); + if (puls2.falling()){ + --k; + t=0.01*(k*1.1);} + myled=!myled; + wait(t); + if(puls3.falling()){ + k=1; + t=0.01; + } + myled=!myled; + wait(t); + } + +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Tue Apr 08 17:42: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