PS2 Joystick
PS2 Joystick
Data Specs
SKU: ASS-1056
Brief Data:
1 www.handsontec.com
Pin Assignment:
This input device interfaces to your Arduino via five pins. Three of which are inputs to your Arduino,
while the remaining two supply voltage and ground.
Output Orientation:
In order to put this thumb controller to use, you need to understand which direction is X and which direction
is Y. You will also need to decipher the direction it is being pushed in either the X or the Y direction. In this
tutorial we are using analog inputs to measure the joystick position. The analog inputs provided indications
that range between 0 and 1023. The graphic below shows the X and Y directions and also gives an
indication of how the outputs will respond when the joystick is pushed in various directions.
2 www.handsontec.com
Arduino PS2 Joystick Tutorial:
Setup the PS2 Joystick to Arduino Uno controller board as below diagram. Note that the use of pull up 1KΩ
resistor between the key switch and the digital input. Once you move beyond experimentation, recommend
some sort of software or hardware debounce for this switch as well.
void setup ()
{
pinMode (KEYin, INPUT);
3 www.handsontec.com
Serial.begin (9600);
}
void loop ()
{
int xVal, yVal, buttonVal;
Serial.print("X = ");
Serial.println (xVal, DEC);
Serial.print("Button is ");
if (buttonVal == HIGH){
Serial.println ("not pressed");
}
else{
Serial.println ("PRESSED");
}
delay (500);
}
Open up the Serial Monitor with baud rate of 9600, move the PS2 joystick and observe the reading:
4 www.handsontec.com
Handsontec. com
5 www.handsontec.com
The Face behind our product quality…
In a world of constant change and continuous technological development, a new or replacement
product is never far away – and they all need to be tested.
Many vendors simply import and sell wihtout checks and this cannot be the ultimate interests of
anyone, particularly the customer. Every part sell on Handsotec is fully tested. So when buying from
Handsontec products range, you can be confident you’re getting outstanding quality and value.
We keep adding the new parts so that you can get rolling on your next project.
P
Engineering Material Mechanical Hardware Electronics Components
6 www.handsontec.com