Squirrels have fuzzy tails.
0 Members and 1 Guest are viewing this topic.
ps2x.read_gamepad(); //read controller and set large motor to spin at 'vibrate' speed // Wish the library had a valid way to verify that the read_gamepad succeeded... Will hack for now if ((ps2x.Analog(1) & 0xf0) != 0x70) { // Controller did not return Analog mode... byte szTemp[80]; int ich; ich = Sprint((char*)szTemp, "PS2 - error(%x): %x %x: %x %x %x %x\r\n", ps2x.Analog(1), ps2x.Analog(3), ps2x.Analog(4), ps2x.Analog(5), ps2x.Analog(6), ps2x.Analog(7), ps2x.Analog(8)); Serial.write(szTemp, ich); return 100; }... if(ps2x.ButtonPressed(PSB_START)) { // OK lets try "0" button for Start.
######################################## Syntax Coloring Map PS2X############################################################################### Datatypes (KEYWORD1)#######################################PS2X KEYWORD1######################################## Methods and Functions (KEYWORD2)#######################################Button KEYWORD2ButtonDataByte KEYWORD2NewButtonState KEYWORD2ButtonPressed KEYWORD2ButtonReleased 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 LITERAL1PSB_TRIANGLE LITERAL1PSB_CIRCLE LITERAL1PSB_CROSS LITERAL1PSB_SQUARE LITERAL1PSS_RX LITERAL1PSS_RY LITERAL1PSS_LX LITERAL1PSS_LY LITERAL1PSAB_PAD_RIGHT LITERAL1PSAB_PAD_UP LITERAL1PSAB_PAD_DOWN LITERAL1PSAB_PAD_LEFT LITERAL1PSAB_L2 LITERAL1PSAB_R2 LITERAL1PSAB_L1 LITERAL1PSAB_R1 LITERAL1PSAB_GREEN LITERAL1PSAB_RED LITERAL1PSAB_BLUE LITERAL1PSAB_PINK LITERAL1PSAB_TRIANGLE LITERAL1PSAB_CIRCLE LITERAL1PSAB_CROSS LITERAL1PSAB_SQUARE LITERAL1
Side note: I was running into cases where I was dropping out of Analog mode so added the above to detect it and not process the data like it was valid...
My library locks the controller so you can't change it's mode using the analog button, so how are you dropping out of analog? The only way i know of is if you are not polling it enough, and if so, the read function will catch it not in the correct mode and reconfigure it before returning.
Each line has the name of the keyword, followed by a tab (not spaces), followed by the kind of keyword
According to the example sketch:"error = ps2x.config_gamepad(13,11,10,12); //setup GamePad(clock, command, attention, data) pins, check for error"Which I assume means:13=clock11=command10=attention12=dataBased on the Pro-Mini's schematic: I translated those pin numbers to the following values:PD5=clockPB3=dataPB4=commandPB5=attentionWhich on the Duemilanove:PD5=digital 5PB3=PWM 11 ?digital?PB4=?digital? 12PB5=?digital? 13
ps2x.config_gamepad(13,11,10,12);
I've got a heck of a youtube message asking for help, i'm going to bring it here to answer, so it can help others with similar problems. The message:Was actually up till 4am last night fighting my Duemilanove trying to get it to recognize the PS2 controller. Still haven't had any luck on that.I used an PS2 Controller extension cord to save my PS2 Controller from having it's connector cut off. I'm starting to think the signal strength isn't good enough over that long of cable?---------------------------------------------------------------------------------------------------------------------------I've also been having a hard time sorting out the correct wiring on the Duemilanove. I've included a description of what I've been doing if you have time to look over it.From your video it looked like you were numbering pins based off the silk screened numbers on the Pro Mini.According to the example sketch:"error = ps2x.config_gamepad(13,11,10,12); //setup GamePad(clock, command, attention, data) pins, check for error"Which I assume means:13=clock11=command10=attention12=dataBased on the Pro-Mini's schematic: I translated those pin numbers to the following values:PD5=clockPB3=dataPB4=commandPB5=attentionWhich on the Duemilanove:PD5=digital 5PB3=PWM 11 ?digital?PB4=?digital? 12PB5=?digital? 13This is the error message that results from that setup:(along with every other setup I've tried)"OUT:IN1:FF42:FF0:FF0:FF0:FF0:FF0:FF0:FF0:FFOUT:IN1:FF42:FF0:FF0:FF0:FF0:FF0:FF0:FF0:FFController mode not matched or no controller foundExpected 0x41 or 0x73, got FFNo controller found, check wiring, see readme.txt to enable debug. visit www.billporter.info for troubleshooting tips"There was one exception to this FF error and that was when I simply followed the silk screened pin numbers on the Duemilanove, I got this msg:(from memory)"Controller mode not matched or no controller foundExpected 0x41 or 0x73, got 0No controller found, check wiring, see readme.txt to enable debug. visit www.billporter.info for troubleshooting tips"The distinction being the 0 instead of the FF.I have the controller's "5. red: power 3.3v" going to the Duemilanove's "3V3" next to "5V""4.black:ground" is going to the "Gnd" next to "5V" and "3V3".I don't have "9. green: acknowledge"; "8. white unknown" or "3. grey: vibration motor power" connected to anything at the moment. I tried running the "3. grey" to both "5V" and a 9VDC powersupply and that didn't seem to improve anything.I'm using a genuine Sony controller, but I've also tried using 5.6K and 180ohm resistors based on the comments on your blog. I did not have any of the 3rd type of resistor, but since I had a "3V3" 3.3VDC power source on my arduino it didn't seem necessary.I hate to cut my extension cord short or even resort to cutting the extension cord out and removing the PS2 controller connector: but they seem to be the most significant distinction between my procedure and what everyone else has been doing.Any advice is appreciated.
OUT:IN1:FF42:10:100:FE0:FF0:FF0:FF0:FF0:FFOUT:IN1:FF42:10:100:FE0:FF0:FF0:FF0:FF0:FFController mode not matched or no controller foundExpected 0x41 or 0x73, got 1No controller found, check wiring, see readme.txt to enable debug. visit [url=http://www.billporter.info]www.billporter.info[/url] for troubleshooting tipsOUT:IN1:FF42:630:100:FE0:FF0:600:700:480:2OUT:IN1:FF42:630:100:FE0:FF0:600:700:480:2Controller mode not matched or no controller foundExpected 0x41 or 0x73, got 63No controller found, check wiring, see readme.txt to enable debug. visit [url=http://www.billporter.info]www.billporter.info[/url] for troubleshooting tips
I used a 5.6K resistor from 5v to data., and there's a 10k resistor between the 5.6k+data and the arduino pin.
Glad it worked!Quote from: cyberdynewins on September 21, 2010, 02:19:02 AMI used a 5.6K resistor from 5v to data., and there's a 10k resistor between the 5.6k+data and the arduino pin.Can you explain this a little better? Did you use one resistor or two? How did you wire it?
I could try removing the 10K resistor and using 5.6k alone?
10K resistor between data and ground.
EDIT: YOU SAW NOTHING! No mistakes here.