![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Joystick program
main.cpp
- Committer:
- thevic16
- Date:
- 2021-05-29
- Revision:
- 0:26bcd36c7885
File content as of revision 0:26bcd36c7885:
#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); } }