Arduino_Button_InterruptIn sample code ported.
Fork of InterruptIn_HelloWorld by
main.cpp
- Committer:
- homayoun
- Date:
- 2014-09-03
- Revision:
- 1:a219c25967db
- Parent:
- 0:7a20a6aa1f5e
File content as of revision 1:a219c25967db:
#include "mbed.h" InterruptIn button(USER_BUTTON); DigitalOut led(LED1); void buttonPressed() { led = 1; } void buttonReleased() { led = 0; } void setup() { // button.mode(PullUp); button.rise(&buttonReleased); // attach the address of the buttonReleased function to the rising edge button.fall(&buttonPressed); // attach the address of the buttonPressed function to the falling edge } void loop() { // put your main code here, to run repeatedly: } int main() { setup(); while(1) loop(); }