Richard Kuo
/
NTOUEE-mbed-GPIO_Interrupt
mbed GPIO Interrupt
Diff: main.cpp
- Revision:
- 0:7d78d405fa52
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Oct 20 12:46:04 2016 +0000 @@ -0,0 +1,13 @@ +// using NuMaker-PFM-NUC472 GPIO interrupt to set led on/off +#include "mbed.h" + +InterruptIn button(D0); +DigitalOut led(LED1); + +void flip() { + led = !led; +} + +int main() { + button.rise(&flip); // if D0 is floating, then rgbled will be flashing +}