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)

Dependencies:   Debounced mbed

Fork of Tarea1-V3 by junior andres calle acevedo

main.cpp

Committer:
juniorACA
Date:
2014-04-08
Revision:
0:f8fe2133f19c

File content as of revision 0:f8fe2133f19c:


#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);
        }
            
}