Jesus Fausto
/
Joystick
Joy to the world
main.cpp
- Committer:
- jvfausto
- Date:
- 2018-07-13
- Revision:
- 0:34022ad4a23d
File content as of revision 0:34022ad4a23d:
#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; }*/ } }