Joystick program

Dependencies:   Joystick

Revision:
0:26bcd36c7885
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sat May 29 04:16:18 2021 +0000
@@ -0,0 +1,27 @@
+#include "mbed.h"
+#include "Joystick.h"
+#include "platform/mbed_thread.h"
+
+ 
+//               Xaxis,Yaxis,Button 
+Joystick joystick(A1, A2, D0);
+
+ 
+int main()
+{
+    //First initalise joystick
+    joystick.init();
+ 
+    while (true) {
+        //Stores x and y output values
+        float x, y;
+ 
+        //Calls the "GetXValue" and "GetYValue" and stores it in x and y
+        x = joystick.GetXValue();
+        y = joystick.GetYValue();
+ 
+        //Prints the values to the terminal
+        printf("X: %f, Y: %f \r \n", x, y);
+        thread_sleep_for(1000);
+    }
+}