
Toggles an LED whenever a digital joystick input goes high
Dependencies: mbed
Revision 0:188b8ea8f365, committed 2015-02-17
- Comitter:
- mb4899
- Date:
- Tue Feb 17 11:46:41 2015 +0000
- Commit message:
- Toggles an LED whenever a digital joystick input goes high
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Tue Feb 17 11:46:41 2015 +0000 @@ -0,0 +1,16 @@ +#include "mbed.h" + +InterruptIn joystick_Reset(p14); // Configure InterruptIn object with p14, which corresponds to joystick reset function +DigitalOut myLED(LED4); // Has to be LED1-4, not a pin + +void toggle(void); + +int main() +{ + joystick_Reset.rise(&toggle); // Attach the address of the toggle to the rising edge +} + +void toggle() +{ + myLED=!myLED; +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Tue Feb 17 11:46:41 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/9ad691361fac \ No newline at end of file