printing joystick when active

Dependencies:   mbed

Revision:
0:56d38c9cd647
Child:
1:9c6ad6449efd
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue May 04 08:22:18 2021 +0000
@@ -0,0 +1,39 @@
+#include "mbed.h"     // Stephen Reidy; lab1
+
+InterruptIn joystickDown(p12);   // joystick Down
+InterruptIn joystickLeft(p13);   // joystick Left
+InterruptIn joystickCenter(p14); // joystick Center
+InterruptIn joystickUp(p15);     // joystick Up
+InterruptIn joystickRight(p16);  // joystick Right
+DigitalOut led(LED1);            // LED 1 digital out
+
+
+
+int main()
+{
+
+    while(1) {
+        if (joystickDown == 1) {
+            printf( "joystickDown is active \r\n");
+        }
+
+        if (joystickLeft == 1) {
+            printf( "joystickLeft is active \r\n");
+        }
+
+        if (joystickCenter == 1) {
+            printf( "joystickCenter is active \r\n");
+        }
+
+        if (joystickUp == 1) {
+            printf( "joystickUp is active \r\n");
+        }
+
+        if (joystickRight == 1) {
+            printf( "joystickRight is active \r\n");
+            
+            
+        }
+
+    }
+}