Nuvoton
/
NuMaker-mbed-GPIO_Interrupt
NuMaker GPIO Interrupt with Debounce Setting
main.cpp@2:15b06747ce59, 2016-11-11 (annotated)
- Committer:
- ccli8
- Date:
- Fri Nov 11 15:59:58 2016 +0800
- Revision:
- 2:15b06747ce59
- Parent:
- 0:29e056412215
- Child:
- 5:b9b7cd06aaf0
Change test pin to SW1 and enable de-bounce
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
rkuo2000 | 0:29e056412215 | 1 | // NuMaker-PFM-NUC472 : GPIO interrupt to set led on/off |
rkuo2000 | 0:29e056412215 | 2 | #include "mbed.h" |
rkuo2000 | 0:29e056412215 | 3 | |
ccli8 |
2:15b06747ce59 | 4 | InterruptIn button(SW1); // Button SW1 |
ccli8 |
2:15b06747ce59 | 5 | DigitalOut led(LED1); // flashing LED1(rgbled1) |
rkuo2000 | 0:29e056412215 | 6 | |
rkuo2000 | 0:29e056412215 | 7 | void flip() { |
rkuo2000 | 0:29e056412215 | 8 | led = !led; |
rkuo2000 | 0:29e056412215 | 9 | } |
rkuo2000 | 0:29e056412215 | 10 | |
rkuo2000 | 0:29e056412215 | 11 | int main() { |
ccli8 |
2:15b06747ce59 | 12 | button.rise(&flip); |
rkuo2000 | 0:29e056412215 | 13 | } |