lab question 1.2

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
niallmoyvane
Date:
Thu May 23 12:19:28 2019 +0000
Commit message:
lab question 1.2

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	Thu May 23 12:19:28 2019 +0000
@@ -0,0 +1,51 @@
+
+#include "mbed.h"
+
+Serial pc(USBTX, USBRX);
+InterruptIn button1(p12);
+InterruptIn button2(p13);
+InterruptIn button3(p14);
+InterruptIn button4(p15);
+InterruptIn button5(p16);
+
+int down=0;
+int left=0;
+int center=0;
+int up=0;
+int right=0;
+
+    void down_check()
+                {
+                    printf("Joystickis pressed towards DOWN direction\n\r");
+                    wait (3);
+                }
+    void left_check()
+                {
+                    printf("Joystickis pressed towards LEFT direction\n\r");
+                    wait (3);
+                }
+    void center_check()
+                {
+                    printf("Joystickis pressed towards CENTER direction\n\r");
+                    wait (3);
+                }
+    void up_check()
+                {
+                    printf("Joystickis pressed towards UP direction\n\r");
+                    wait (3);
+                }
+    void right_check()
+                {
+                    printf("Joystickis pressed towards RIGHT direction\n\r");
+                    wait (3);
+                }
+    
+            int main()
+                    {
+                        //timer_temp start();
+                        button1.rise(&down_check);
+                        button2.rise(&left_check);
+                        button3.rise(&center_check);
+                        button4.rise(&up_check);
+                        button5.rise(&right_check);
+                    }
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu May 23 12:19:28 2019 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400
\ No newline at end of file