background image

ROBOT . HEAD to TOE

                                                                    

Product User’s Manual – Shield­PS2

6.3 All PS2 Button and Joystick Status

Send (decimal)

Response from PS2

Description

31

6 bytes of data:

1st byte: digital button group 1
2nd byte: digital button group 2
3rd byte: Right Joystick X axis
4th byte: Right Joystick Y axis
5th byte: Left Joystick X axis
6th byte: Left Joystick Y axis

Shield­PS2 will return the status of all
digital and analog joystick of PS2

Digital group 1:

bit 7 (MSB): Left button
bit 6: Down button
bit 5: Right button
bit 4: Up button
bit 3: Start button
bit 2: Right Joystick Center button
bit 1: Left Joystick Center button
bit 0 (LSB): Select button

Digital group 2:

bit 7 (MSB): Square button
bit 6: Cross button
bit 5: Circle button
bit 4: Triangle button
bit 3: R1 button
bit 2: L1 button
bit 1: R2  button
bit 0 (LSB): L2 button

0

 if the button is pressed

1

 if button is not pressed

Example:

If microcontroller sent 

31

 (decimal),

Shield­PS2 will check all the button and
joystick status and return 6 bytes to
microcontroller.

Created by Cytron Technologies Sdn. Bhd. – All Rights Reserved

18

Summary of Contents for Shield-PS2

Page 1: ...ROBOT HEAD to TOE Product User s Manual Shield PS2 Shield PS2 Cytron PS2 Shield User s Manual V1 0 September 2013 Created by Cytron Technologies Sdn Bhd All Rights Reserved 1...

Page 2: ...on and Limitations 5 4 Board and Product Layout 6 5 Hardware Interface 8 5 1 Choose SONY PS2 Dual Shock Controller 10 6 Protocol 15 6 1 PS2 Button and joystick status 15 6 2 On Board vibrator motor co...

Page 3: ...d or wireless Shield PS2 has stackable side headers which allows for more Arduino shields to be stacked on top of it Besides user has option to use either hardware or software UART with Arduino s main...

Page 4: ...t User s Manual Shield PS2 2 0 PACKING LIST 1 1 x Shield PS2 2 3 x mini jumper 3 User s manual and sample source code can be downloaded from http www cytron com my Created by Cytron Technologies Sdn B...

Page 5: ...TATIONS Dimensions No Parameters Min Typical Max Unit 1 Input Voltage Logic Operation Voltage 4 5 5 5 V 2 Current Consumption 100 150 500 mA 3 VIOH Logic Input High Level 3 5 5 0 5 5 V 4 VIOL Logic In...

Page 6: ...eader This is the analog port of the Arduino The stackable header allows other stacked shield to utilize these pins 2 Stackable Power Pins Header This is the power port of the Arduino The stackable he...

Page 7: ...shows that power is supplied to Cytron PS2 Shield 6 Baud Rate selector To select the preferable UART baud rate For Cytron PS2 Shield to obtain latest baudrate from selector Shield PS2 need to be reset...

Page 8: ...et to D2 However other pins may be selected if these pins are already used by other application If hardware serial pin D0 D1 is selected user needs to unplug the PS2 Connector from the Shield PS2 befo...

Page 9: ...ary can be downloaded from the SHIELD PS2 product page at Cytron s website Connect the PS2 joystick to the PS2 connector socket on SHIELD PS2 as shown Don t forget about the power source for the Ardui...

Page 10: ...ROBOT HEAD to TOE Product User s Manual Shield PS2 Created by Cytron Technologies Sdn Bhd All Rights Reserved 10...

Page 11: ...d wireless type of SONY PS2 controller There are many types of PS controller in the market and the sensitivity for each type also different User is advised to use original PS2 controller Cytron Techno...

Page 12: ...ave 2 axes and there are two formats of output These formats will be explained later User may choose format 1 or format 2 NOTE SONY PS2 controller does not come with PS2 Shield please purchase separat...

Page 13: ...eft value change from 128 to 0 Push towards right value change from 128 to 255 Left joystick have X axis and Y axis Right joystick also have its own X and Y axis Analog value of Format 1 Taking an exa...

Page 14: ...to left down corner The value of left joystick will change will should get approximately j_ll 10 j_ld 50 You can choose whichever format to use by sending particular command to PS2 Shield Please do t...

Page 15: ...ean X axis format 1 range 0 to 255 y mean Y axis format 1 range 0 to 255 u mean Up axis format 2 range 0 to 100 d mean Down axis format 2 range 0 to 100 l mean Left axis format 2 range 0 to 100 r mean...

Page 16: ...entre button right joystick centre button START button up button right button down button left button L2 button R2 button L1 button R1 button triangle button circle button cross button square button A...

Page 17: ...28 Return the connection status of PS2 controller on Shield PS2 Shield PS2 will read PS2 controller status 1 is return if controller is detected or connected to the PS2 connector on Shield PS2 6 2 On...

Page 18: ...l group 1 bit 7 MSB Left button bit 6 Down button bit 5 Right button bit 4 Up button bit 3 Start button bit 2 Right Joystick Center button bit 1 Left Joystick Center button bit 0 LSB Select button Dig...

Page 19: ...d PS2 Examples Example of UART communication shows main board obtain the Circle button of PS2 Example of UART communication shows mainboard obtain the Left jostick X axis value of PS2 Created by Cytro...

Page 20: ...by misuse is not covered under warranty Warranty does not cover freight cost for both ways Prepared by Cytron Technologies Sdn Bhd 19 Jalan Kebudayaan 1A Taman Universiti 81300 Skudai Johor Malaysia T...

Reviews: