Beginners: please read this post and this post before posting to the forum.
0 Members and 1 Guest are viewing this topic.
Try applying 7.6-9V to the rumble power wire.
if(ps2x.Button(PSB_PAD_UP)) { //will be TRUE as long as button is pressed Serial.print("Up held this hard: "); Serial.println(ps2x.Analog(PSAB_PAD_UP), DEC);
if(ps2x.Button(PSB_PAD_UP)) { //will be TRUE as long as button is pressed myservo.write(val)
if(ps2x.Button(PSB_PAD_UP)) //will be TRUE as long as button is pressed myservo.write(++val)
^^^^ Thanks for answering him hyper. Like hyper posted, the wiring diagram is on my website. Also note, I am using a 5V arduino without level shifting and it worked fine with the controller also powered with 5V. Hell, it worked fine without the controller powered at all, oddly enough.
Will it work with this one?http://cgi.ebay.com/PS2-Sony-Playstation-2-Wireless-Game-Controller-Black-/250638410320?cmd=ViewItem&pt=AU_PC_Video_Games_Games&hash=item3a5b36a250#ht_4944wt_1133
I've also been researching the 'rumble' and 'pressure switches' via the Parallax Forum posts which give some good examples - albeit in Basic - of the commands to send so quite easy to set uo.
static byte enter_config[]={0x01,0x43,0x00,0x01,0x00};static byte set_mode[]={0x01,0x44,0x00,0x01,0x03,0x00,0x00,0x00,0x00};static byte set_bytes_large[]={0x01,0x4F,0x00,0xFF,0xFF,0x03,0x00,0x00,0x00};static byte exit_config[]={0x01,0x43,0x00,0x00,0x5A,0x5A,0x5A,0x5A,0x5A};static byte enable_rumble[]={0x01,0x4D,0x00,0x00,0x01};
You may also want to look at adding the deadzone code as well (thanks Dunk) as it makes the joystick less sensitive.
I tested it with an ps2 controller, its not the genuine but its compatible with the ps2.And it didn't work i tested the wiring again and again but the only thing i managed to do is change the state of the analog button led.And the pins are declared correctly.What im doing wrong?
You are using a 3.3V Arduino or a 5V with a level shifter?
Do you actually pay you enough for upkeeping a mustang or something near???
@Admin, did you summer intern give up on me? Java and a Xbox controller instead? Kids these days...
######################################## Syntax Coloring Map PS2X############################################################################### Datatypes (KEYWORD1)#######################################PS2X KEYWORD1######################################## Methods and Functions (KEYWORD2)#######################################Button KEYWORD2ButtonDataByte KEYWORD2NewButtonState KEYWORD2NewButtonState KEYWORD2ButtonPressed KEYWORD2ButtonReleased KEYWORD2read_gamepad KEYWORD2read_gamepad KEYWORD2config_gamepad KEYWORD2enableRumble KEYWORD2enablePressures KEYWORD2Analog KEYWORD2######################################## Constants (LITERAL1)#######################################PSB_SELECT LITERAL1PSB_L3 LITERAL1PSB_R3 LITERAL1PSB_START LITERAL1PSB_PAD_UP LITERAL1PSB_PAD_RIGHT LITERAL1PSB_PAD_DOWN LITERAL1PSB_PAD_LEFT LITERAL1PSB_L2 LITERAL1PSB_R2 LITERAL1PSB_L1 LITERAL1PSB_R1 LITERAL1PSB_GREEN LITERAL1PSB_RED LITERAL1PSB_BLUE LITERAL1PSB_PINK LITERAL1PSS_RX LITERAL1PSS_RY LITERAL1PSS_LX LITERAL1PSS_LY LITERAL1