![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Joy to the world
Revision 0:34022ad4a23d, committed 2018-07-13
- Comitter:
- jvfausto
- Date:
- Fri Jul 13 22:24:30 2018 +0000
- Commit message:
- Joy to the world
Changed in this revision
--- /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