Nuvoton
/
NuMaker-mbed-GPIO_Interrupt
NuMaker GPIO Interrupt with Debounce Setting
Diff: main.cpp
- Revision:
- 0:29e056412215
- Child:
- 2:15b06747ce59
diff -r 000000000000 -r 29e056412215 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Fri Oct 14 07:59:15 2016 +0000 @@ -0,0 +1,13 @@ +// 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 +}