Shopping Cart
0 items
 

Joystick Breakout board

Joystick Breakout board
Click to enlarge
Price: R60
Availability: In Stock
Model: SHD021
Location: G

This is a joystick very similar to the 'analog' joysticks on PlayStation 2 controllers. Directional movements are simply two potentiometers - one for each axis. Pots are ~10k each. This joystick also has a select button that is actuated when the joystick is pressed down. The joystick comes mounted on a breakout board and the pins are broken out to a 0.1" header and includes 4 mounting holes in the corners. There are 5 pins on board: VCC, GND, X, Y and Button. Connect the module with 5V power suppy with VCC and GND, you can read out the joystick status by X,Y and button pins. When using the 5V power supply, the default analog output for X,Y is 2.5V. With the direction of the arrow, the voltage up to 5V, and the opposite direction down to 0V. 

 

Schematic 

 

Example Circuit - Joystick controlling servo 

joystick servo control

 

#include <Servo.h> 

Servo myservo;  // create servo object to control a servo 

int potpin = 0;     // analog pin -  x potentiometer on joystick

int val;                  // variable to read - analog pin 

void setup() 

  myservo.attach(9);  // attaches the servo on pin 9 to the servo object 

 

void loop() 

  val = analogRead(potpin);              // reads the potentiometer (value between 0 and 1023) 

  val = map(val, 0, 1023, 0, 179);     // scale it to with the servo (value between 0 and 180) 

  myservo.write(val);                          // sets the servo position according to the scaled value 

  delay(15);                                         // waits for the servo to get there 

There are no additional images for this product.