0% found this document useful (0 votes)
227 views2 pages

Analog Joystick Interfacing With ARM MBED - MBED

This document discusses interfacing an analog joystick with an ARM MBED microcontroller board. It explains that an analog joystick outputs two voltages corresponding to its position on the X and Y axes. It also provides an example code that uses two AnalogIn pins on a MBED board to read the joystick's X and Y axis voltages and display them continuously on the serial monitor.

Uploaded by

Krishanu Modak
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
227 views2 pages

Analog Joystick Interfacing With ARM MBED - MBED

This document discusses interfacing an analog joystick with an ARM MBED microcontroller board. It explains that an analog joystick outputs two voltages corresponding to its position on the X and Y axes. It also provides an example code that uses two AnalogIn pins on a MBED board to read the joystick's X and Y axis voltages and display them continuously on the serial monitor.

Uploaded by

Krishanu Modak
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Analog Joystick Interfacing with ARM 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

Displaying analog joystick voltages in X and Y directions on the serial monitor.

Here, we will be using the analog pins of MBED to process the analog voltages of the joystick.

Program

#include "mbed.h"

Serial pc(USBTX, USBRX); // tx, rx

AnalogIn analog_value_x(p15);

AnalogIn analog_value_y(p16);

int main() {

while(1){

pc.printf("X Value = %f\n\r", analog_value_x.read() * 3.3);

pc.printf("Y Value = %f\n\r", analog_value_y.read() * 3.3);

wait(0.5);

Output of Serial

You might also like