• +965 51122049
XY-axis joystick module

XY-axis joystick module

KWD0.500KWD0.500
0%Off

XY-axis joystick module


 

 


Share:

PS2 game joystick axis sensor module

product description

The same company produces PS2 game joystick axis sensor module consists of using original quality metal PS2 joystick potentiometer system For the (X, Y) a 2-axis analog output and for (Z) 1 digital output channel button.

Specifications

The joystick is a combination of 2 analoog potentiometer and a digital switch.

Test

  • Arduino controller × 1
  • USB data cable × 1
  • PS2 Game sensor module × 1

Schematic

  • Arduino GND --> Module pin -
  • Arduino +5V --> Module pin +5V
  • Arduino Analog 0 --> Module VRx
  • Arduino Analog 1 --> Module VRy
  • Arduino Digital --> Resistor-->Module SW

you need a resistor, you can use Arduino internal pullup resistor, command ( pinMode(pin, INPUT_PULLUP); ) does the job

Example Code

// Module KY023
	
	
	
	
	
	
// For more info see http://tkkrlab.nl/wiki/Arduino_KY-023_XY-axis_joystick_module
	
	
	
	
	
	
int
	
	
	
	
	
	 JoyStick_X =
	
	
	
	
	
	 A0;
	
	
	
	
	
	 // x
	
	
	
	
	
	
int
	
	
	
	
	
	 JoyStick_Y =
	
	
	
	
	
	 A1;
	
	
	
	
	
	 // y
	
	
	
	
	
	
int
	
	
	
	
	
	 JoyStick_Z =
	
	
	
	
	
	 3
	
	
	
	
	
	;
	
	
	
	
	
	 // key
	
	
	
	
	
	
void
	
	
	
	
	
	 setup ()
	
	
	
	
	
	
{
	
	
	
	
	
	
  pinMode (
	
	
	
	
	
	JoyStick_X,
	
	
	
	
	
	 INPUT)
	
	
	
	
	
	;
	
	
	
	
	
	
  pinMode (
	
	
	
	
	
	JoyStick_Y,
	
	
	
	
	
	 INPUT)
	
	
	
	
	
	;
	
	
	
	
	
	
  pinMode (
	
	
	
	
	
	JoyStick_Z,
	
	
	
	
	
	 INPUT_PULLUP)
	
	
	
	
	
	;
	
	
	
	
	
	
  Serial.begin
	
	
	
	
	
	 (
	
	
	
	
	
	9600
	
	
	
	
	
	)
	
	
	
	
	
	;
	
	
	
	
	
	 // 9600 bps
	
	
	
	
	
	
}
	
	
	
	
	
	
void
	
	
	
	
	
	 loop ()
	
	
	
	
	
	
{
	
	
	
	
	
	
  int
	
	
	
	
	
	 x,
	
	
	
	
	
	 y,
	
	
	
	
	
	 z;
	
	
	
	
	
	
  x =
	
	
	
	
	
	 analogRead (
	
	
	
	
	
	JoyStick_X)
	
	
	
	
	
	;
	
	
	
	
	
	
  y =
	
	
	
	
	
	 analogRead (
	
	
	
	
	
	JoyStick_Y)
	
	
	
	
	
	;
	
	
	
	
	
	
  z =
	
	
	
	
	
	 digitalRead (
	
	
	
	
	
	JoyStick_Z)
	
	
	
	
	
	;
	
	
	
	
	
	
  Serial.print
	
	
	
	
	
	 (
	
	
	
	
	
	x,
	
	
	
	
	
	 DEC)
	
	
	
	
	
	;
	
	
	
	
	
	
  Serial.print
	
	
	
	
	
	 (
	
	
	
	
	
	","
	
	
	
	
	
	)
	
	
	
	
	
	;
	
	
	
	
	
	
  Serial.print
	
	
	
	
	
	 (
	
	
	
	
	
	y,
	
	
	
	
	
	 DEC)
	
	
	
	
	
	;
	
	
	
	
	
	
  Serial.print
	
	
	
	
	
	 (
	
	
	
	
	
	","
	
	
	
	
	
	)
	
	
	
	
	
	;
	
	
	
	
	
	
  Serial.println
	
	
	
	
	
	 (
	
	
	
	
	
	z,
	
	
	
	
	
	 DEC)
	
	
	
	
	
	;
	
	
	
	
	
	
  delay (
	
	
	
	
	
	100
	
	
	
	
	
	)
	
	
	
	
	
	;
	
	
	
	
	
	
}
	
	
	
	
	
	


 


Add your review

Your email address will not be published. Required fields are marked *

Please login to write review!

Upload photos

Looks like there are no reviews yet.

Related Products