Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Joystick Class Reference
#include <Joystick.h>
Detailed Description
Joystick Class.
Acknowledgements to Dr Craig A. Evans, University of Leeds Library for interfacing with analogue joystick Dr Edmond Nurellari, University of Lincoln
Example:
#include "mbed.h" #include "Joystick.h" // y x button Joystick joystick(PTB10,PTB11,PTC16); int main() { joystick.init(); while(1) { Vector2D coord = joystick.get_coord(); printf("Coord = %f,%f\n",coord.x,coord.y); Vector2D mapped_coord = joystick.get_mapped_coord(); printf("Mapped coord = %f,%f\n",mapped_coord.x,mapped_coord.y); float mag = joystick.get_mag(); float angle = joystick.get_angle(); printf("Mag = %f Angle = %f\n",mag,angle); Direction d = joystick.get_direction(); printf("Direction = %i\n",d); if (joystick.button_pressed() ) { printf("Button Pressed\n"); } wait(0.5); } }
Definition at line 78 of file Joystick.h.
Generated on Sun Jul 31 2022 21:19:10 by
