Analog Joystick Interfacing With ARM MBED - MBED
Analog Joystick Interfacing With ARM MBED - MBED
Analog Joystick
Applications like video games that require a change in cursor position in a 2-D plane make use of analog joysticks as input
devices.
Analog joystick produces two voltages; one corresponding to position with respect to X-axis and another corresponding to the
position with respect to Y-axis. The voltages produced depend on the position of the joystick.
For more information about Analog Joystick and how to use it, refer the topic Analog Joystick in the sensors and modules
section.
To interface the Analog Joystick with MBED, we need to use ADC on the microcontroller of the ARM MBED board.
Interfacing Diagram
Interfacing Analog Joystick Module with ARM MBED
Example
Here, we will be using the analog pins of MBED to process the analog voltages of the joystick.
Program
#include "mbed.h"
AnalogIn analog_value_x(p15);
AnalogIn analog_value_y(p16);
int main() {
while(1){
wait(0.5);
Output of Serial