Pages: 1 2 3 [4] 5   Go Down
Author Topic: Playstation Controller  (Read 14122 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 6
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Another update.

I connected a wired Sony Dualshock 2. Same continuous stream of button presses printed to serial terminal. Even when power and ground disconnected!  :o

Oh and the button presses are not random, they are in order of 'if.. then' tests, 'SELECT' through 'X'.
« Last Edit: March 14, 2010, 01:27:46 am by mannyr7 » Logged

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 62
Arduino Mega rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

you ur terminal thing is at a different baud then the board, in the setup function, there is a Serial.begin(some number); the monitor has to be the same number thing.......
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 6
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

No thats not it. Serial begin is 57600 and so is terminal. Anything else would just read gibberish. And I am not pushing any buttons, so why the output?
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 2
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hey. I just tryed this out and was amazed. smiley-razz i just wonder, is there any outputs. So i can use the PS control for something. In the best case like a 16 bit serial so i can convert that to parallell (with a multiplexer) and use it for whatever i want?

Sorry for bad English. Im from Sweden you know smiley-wink

Anyway. Thanks for everything. Hope you can help me out smiley-grin
« Last Edit: March 16, 2010, 02:29:08 pm by Entex » Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 2
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

ow. Nice i got this to work smiley-razz

void loop () {
    read_gamepad();
    if(PSButton(PSB_SELECT)){
     Serial.print("Select\n");
     int hejhej = 7;
     pinMode(hejhej,OUTPUT);
     digitalWrite(hejhej,HIGH);
     delay(5);
     digitalWrite(hejhej,LOW);
    }

i will continue to try this out more.. hopefully i will learn my way and get my 16 bit serial multiplex cutcutpewpew smiley-grin
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 4
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I too seem to get a similar result to mannyr7 using a PS1 controller.

I get a stream of button presses without actually pressing anything.

could someone tell me if this to be expected or am i doing something wrong. I've been trying to get this to work for ages

thanks
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 6
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

In my situation, I'm thinking its the decode byte. But I have no idea what to replace it with. And PS1 controllers are half the clock of the PS2, if I remember correctly.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 1
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Can someone post some pictures as how they hooked theirs up to their arduino?
Logged

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 62
Arduino Mega rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes, can someone post pictures of it being wired up; hopefully to the mega.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 6
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I have tried so much code (from many sources) over at least a month and nothing works.  I have to edit the <include> code to even get it to compile, even then it still does not work.  

Please, those of you that have had success with hooking up a Playstation 2 gamepad to their Arduino (I have a non-mega), please post your electronics hookups and full code as it would really help the rest of us out that are clearly missing something.  

Thanks!
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 4
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

i've european ps2 and my controller's  hw board is different!
in many different sites this controller has different colors..
this is mine with color cables

http://img229.imageshack.us/img229/364/teorico.jpg

and this is other websites with different colors

http://letsmakerobots.com/node/18599
http://store.curiousinventor.com/guides/PS2
http://www.lynxmotion.com/images/html/build036.htm

i have arduino2009

i want to be able to use analog sticks to pilot servos and other things..
and i'm confused 'cause this color's difference

M
« Last Edit: May 28, 2010, 03:31:51 pm by mrbang » Logged

0
Offline Offline
Jr. Member
**
Karma: 1
Posts: 53
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

YESSSS!!!!

Shutter I could kiss you. Weeks trying to get other PS2 controller libraries working and your last code post works like a charm on my Arduino Pro mini.

But it looks like there it doesn't support the analog sticks yet? I need those as I am build a controller for my ground vehicle.

I really would like those analog sticks to work, and I'm willing to make a donation to you for the work finishing you library. If you beat me(I'm gonna try in the mean time) at adding analog stick values to your code, i'll give you a $20 donation.  If you don't believe me, PM me a PayPal email and I'll send you $10 for getting me this far already, and another $10 when you add the stick values.

Logged

0
Offline Offline
Jr. Member
**
Karma: 1
Posts: 53
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Well, I seemed to have devised my own addition that reads stick values.

Code:

In header:

//These are stick values
#define PSS_RX 5
#define PSS_RY 6
#define PSS_LX 7
#define PSS_LY 8


Then as a function.

byte PSStick(unsigned int stick) {
  return PS2data[stick];
}


So PSStick(PSS_LY) returns the value of the left sticks Y axis.

Offer for donation still stands if you put a little work into making this a library, commenting the code on how it works, and/or come up with a better method of reading the sticks then I.
« Last Edit: May 31, 2010, 06:02:18 pm by madsci1016 » Logged

0
Offline Offline
Jr. Member
**
Karma: 1
Posts: 53
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Well, through need I went ahead and did my best to make Shutter's code into a library with analog stick support. (Shutter, hope you don't mind, I still want to donate to you if you PM me a paypal address)

The library, example sketch, and details are all available on my website at:

http://www.billporter.info/?p=219

Please post comments / bugs there if you are using my lib version of Shutter's code.
Logged

0
Offline Offline
Jr. Member
**
Karma: 1
Posts: 53
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I've started going full speed on making my version of the library more powerful. Here's a taste:

psx.Button(this_button) is TRUE if this_button is currently pressed
psx.NewButtonState() will return TRUE if any button changed state
psx.NewButtonState(this_button) will return TRUE if this_button changed state
psx.ButtonPressed(this_button) will return TRUE if this_button was just pressed
psx.ButtonReleased(this_button) will return TRUE if this_button was just released

I think that this should cover all possible uses for a button.

I'm not going to keep updates on this forum, so be sure to check my site for updates with bug fixes and more features. Up next on my list is to enable rumble and read the button pressures.
Logged

Pages: 1 2 3 [4] 5   Go Up
Jump to: