Toggles an LED whenever a digital joystick input goes high

Dependencies:   mbed

Files at this revision

API Documentation at this revision

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