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
Diff: main.cpp
- Revision:
- 0:f8fe2133f19c
--- /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); + } + +} +