Alexander Leber / Mbed 2 deprecated m0_TasterCounter10V2

Dependencies:   mbed

main.cpp

Committer:
DoTTi
Date:
2016-01-21
Revision:
0:369891f9a34f

File content as of revision 0:369891f9a34f:

#include "mbed.h"
 
DigitalOut myled(LED1);
DigitalIn taster(P0_10);

int main()
{
int counter=-1;
int tasteralt=1;
int tasterneu;

    //taster.mode(PullUp);
    wait(.001);
    while(1) {
        tasterneu = taster;
        if ((tasterneu==0) && (tasteralt==1))
        {
            counter++;
        }
        if(counter ==10)
        {
            myled=1;
            wait(1);
            counter=0;
        }
        else{
            myled=0;
        }
        tasteralt = tasterneu;
    }
}