mbed GPIO Interrupt

main.cpp

Committer:
rkuo2000
Date:
2016-10-20
Revision:
0:7d78d405fa52

File content as of revision 0:7d78d405fa52:

// 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
}