Simple Debouncing library and sample code.

Dependencies:   DebouncedIn mbed

main.cpp

Committer:
SIT2016
Date:
2016-06-14
Revision:
2:e7f390d1e86c
Parent:
1:3f6f29315707

File content as of revision 2:e7f390d1e86c:

#include "mbed.h"
#include "DebouncedIn.h"

DigitalOut led(LED1); //red led
DebouncedIn button(PTC9); //switch

int main() {
    while(1) {
        //using library directly
        if (button.rising()){ //execute only if rising edge detected on the button.
           led = !led;
        }
    }
}