Author Topic: Arduino PS2 Controller  (Read 15879 times)

0 Members and 1 Guest are viewing this topic.

Offline JSH21Topic starter

  • Jr. Member
  • **
  • Posts: 16
  • Helpful? 0
Arduino PS2 Controller
« on: August 03, 2008, 10:12:58 PM »
Hi can you connect an Arduino Diecimila board to a ps2 controller so you can control the servos you have attached to it?

Offline sonictj

  • Supreme Robot
  • *****
  • Posts: 416
  • Helpful? 11
    • Tim's Workshop
Re: Arduino PS2 Controller
« Reply #1 on: August 04, 2008, 03:37:58 AM »
I just checked the arduino forum and found this http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1203744779.

you could also do what I do, which is use  Glovepie to emulate keyboard presses to control the arduino.  http://carl.kenner.googlepages.com/glovepie

works with wiimotes ,the ps3 sixaxis and a few other controllers I think.

 
« Last Edit: August 04, 2008, 03:44:57 AM by sonictj »

Offline JSH21Topic starter

  • Jr. Member
  • **
  • Posts: 16
  • Helpful? 0
Re: Arduino PS2 Controller
« Reply #2 on: August 04, 2008, 11:11:57 AM »
Cool thanks very much :)

Offline sonictj

  • Supreme Robot
  • *****
  • Posts: 416
  • Helpful? 11
    • Tim's Workshop
Re: Arduino PS2 Controller
« Reply #3 on: August 04, 2008, 01:15:36 PM »
if you use glovepie you will want to map out buttons with both a key and a enter press.

*example
when the wiimote's "a" button is pressed keyboard "a" and keyboard "enter" are emulated. key.enter is a part of the code, because the arduino software requires it to send data.

*note look over golepie's syntax.  It is VERY easy to code in but its a bit different from wiring.

GLOVEPIE

Code: [Select]
key.a + key.enter = wiimote.a
key.b + key.enter = wiimote.b


arduino code

Code: [Select]
// wiimote led on off control

#define led 13

char cin(){
  while(true){
    if(Serial.available() > 0){
      return Serial.read();
}}}

void setup(){
Serial.begin(115200);  //this is the baud I typically use
pinMode(led,OUTPUT);
}

void loop(){
char command = cin();

     if(command == 'a') digitalWrite(led,HIGH);
else if(command == 'b') digitalWrite(led,LOW);
}



« Last Edit: August 04, 2008, 02:02:02 PM by sonictj »

Offline madsci1016

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 1,450
  • Helpful? 43
    • Personal Website
Re: Arduino PS2 Controller
« Reply #4 on: June 25, 2010, 04:38:20 PM »
For those who find this thread through Google, I have created a fully functional PS2 Controller Arduino library.

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

Enjoy.

 


Get Your Ad Here

data_list