Joy to the world

Dependencies:   Joystick mbed

Files at this revision

API Documentation at this revision

Comitter:
jvfausto
Date:
Fri Jul 13 22:24:30 2018 +0000
Commit message:
Joy to the world

Changed in this revision

Joystick.lib Show annotated file Show diff for this revision Revisions of this file
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/Joystick.lib	Fri Jul 13 22:24:30 2018 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/eencae/code/Joystick/#649b59b2fb26
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Fri Jul 13 22:24:30 2018 +0000
@@ -0,0 +1,24 @@
+#include "mbed.h"
+#include "Joystick.h"
+ 
+//               Xaxis,Yaxis,Button 
+Joystick joystick(PTB2, PTB3, PTB11);
+DigitalOut r_led(LED_RED);
+Serial pc(USBTX, USBRX);
+ 
+int main()
+{
+    //First initalise joystick
+    joystick.init();
+ 
+    while (true) {
+        
+        Vector2D coord = joystick.get_coord();
+        pc.printf("Coord = x %3f\ty %3f\r\n",(coord.x+1)/2,(coord.y+1)/2);
+        //If the button flag is pressed switch the led
+/*        if (joystick.button_pressed()) {
+            pc.printf("button is pressed\t"); 
+            r_led = !r_led;
+        }*/
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Fri Jul 13 22:24:30 2018 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/mbed/builds/a7c7b631e539
\ No newline at end of file