NuMaker GPIO Interrupt with Debounce Setting

main.cpp

Committer:
rkuo2000
Date:
2016-10-14
Revision:
0:29e056412215
Child:
2:15b06747ce59

File content as of revision 0:29e056412215:

// NuMaker-PFM-NUC472 : GPIO interrupt to set led on/off
#include "mbed.h"

InterruptIn button(PG_1); // D0 
DigitalOut led(LED1);     // flashing LED1(rgbled1)

void flip() {
    led = !led;
}

int main() {
    button.rise(&flip); // if D0 is floating, then rgbled will be flashing
}