Society of Robots - Robot Forum
Electronics => Electronics => Topic started by: JSH21 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?
-
I just checked the arduino forum and found this http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1203744779 (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 (http://carl.kenner.googlepages.com/glovepie)
works with wiimotes ,the ps3 sixaxis and a few other controllers I think.
-
Cool thanks very much :)
-
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
key.a + key.enter = wiimote.a
key.b + key.enter = wiimote.b
arduino code
// 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);
}
-
For those who find this thread through Google, I have created a fully functional PS2 Controller Arduino library.
http://www.billporter.info/?p=240 (http://www.billporter.info/?p=240)
Enjoy.