Analogue Joystick Controller

£ 2.55

FREE DELIVERY


Here we have an arduino compatible Joystick. This device is 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.

  • Joystick Module with Click Button.
  • Voltage: 5v
  • Output: Analog
  • 1 x Joystick
item

Analogue Joystick Controller

Connecting this module is very simple. Just hook up the 5 pins directly to your Arduino.

  • Arduino
  • Joystick Module
  • Jumper wire
image

The X and Y axis go to the analogue pins of your Arduino and the switch is optional

The X and Y axis are actually POT devices, so when tilting the joystick, the X will have a certain voltage from 0 - 5V corresponding to the tilt and the Y acts the same.


// Thumb Joystick example
// The joystick outputs two analog voltages (VERT and HORIZ), and one digital signal (SEL) for the pushbutton.

// Connections to joystick (change if you use different pins):

const int VERT = 0; // analog
const int HORIZ = 1; // analog
const int SEL = 2; // digital

// Also connect the joystick VCC to Arduino 5V, and joystick GND to Arduino GND.

// This sketch outputs serial data at 9600 baud (open Serial Monitor to view).

void setup()
{
  // make the SEL line an input
  pinMode(SEL,INPUT);
  // turn on the pull-up resistor for the SEL line (see http://arduino.cc/en/Tutorial/DigitalPins)
  digitalWrite(SEL,HIGH);

  // set up serial port for output
  Serial.begin(9600);
}

void loop() 
{
  int vertical, horizontal, select;
  
  // read all values from the joystick
  
  vertical = analogRead(VERT); // will be 0-1023
  horizontal = analogRead(HORIZ); // will be 0-1023
  select = digitalRead(SEL); // will be HIGH (1) if not pressed, and LOW (0) if pressed
  
  // print out the values
  
  Serial.print("vertical: ");
  Serial.print(vertical,DEC);
  Serial.print(" horizontal: ");
  Serial.print(horizontal,DEC);
  Serial.print(" select: ");
  if(select == HIGH)
    Serial.println("not pressed");
  else
    Serial.println("PRESSED!");
}  


  • 1. VCC
  • 2. GND
  • 3. X - Axis
  • 4. Y - Axis
  • 5. Swtich