ps2 controlled project

Hi, I just found out about the arduino about 2 weeks ago and rushed out and bought one. I have been researching for two weeks about how to use it. What i want to do is control a 4wd home made Rc with a pan and tilt turret on top. I want to use a ps2 controller and use wireless xbees. I have already used the psx2 code, and got the controller working. So im have a problem trying to learn how to get the arduino uno to output to transistors so i can run motors and servos with the joy sticks. I know to makes the circuits for the motors with transistors and what not. Basically i want the left joy stick to drive foward,back,left,and right, and the right joy stick to pan and tilt some servos tied togeather. Ill be using four motors the drive each wheel. I need some help with adding to the psx2 program to make this happen. Any help would be great thanks!

Ok last night i found this code, and uploaded it to the arduino. Pins 11 and 9 are motor outputs, it works ok, still having problems with the joysticks. When i press R1,L1 on the controller this allows me too use the joysticks to control the speed of the motors, the problem is that i have to hold the joy sticks all the way down or the motors will spin about half speed. I have tried to fix this in the code but have not had any luck. here is the code!

#include <PS2X_lib.h>

PS2X ps2x;

//int Lp = 7;
//int Ln = 4;
//int Rp = 8;
//int Rn = 12;
int El = 11;
int Er = 9;
int right_speed = 0;
int left_speed = 0;

void setup () {
ps2x.config_gamepad(2,6,4,7, true, true);
//pinMode (Lp, OUTPUT);
//pinMode (Ln, OUTPUT);
//pinMode (Rp, OUTPUT);
//pinMode (Rn, OUTPUT);
pinMode (El, OUTPUT);
pinMode (Er, OUTPUT);

digitalWrite (El,LOW);
digitalWrite (Er,LOW);
Serial.begin(9600);
}

void loop () {
ps2x.read_gamepad();
left_speed = ps2x.Analog(PSS_LY);
right_speed = ps2x.Analog(PSS_RY);
left_speed = 255 - left_speed;
right_speed = 255 - right_speed;
left_speed = map(left_speed, 127, 255, -255, 255);
right_speed = map(right_speed, 127, 255, -255, 255);
if((left_speed>=-25) && (left_speed<=45)) {
left_speed = 0;
}
//WHAT SHOULD I PUT IN THE ELSE STATEMENT??
Serial.print("Left Joystick Value: ");
Serial.print(left_speed);
Serial.print("\t");
Serial.print("Right Joystick Value: ");
Serial.println(right_speed);

if(ps2x.Button(PSB_L1) && ps2x.Button(PSB_R1)) {
analogWrite(Er, right_speed);
analogWrite(El, left_speed);
}

else {
analogWrite(Er, 0);
analogWrite(El, 0);
}
}

cliffsupraturbo:
Hi, I just found out about the arduino about 2 weeks ago and rushed out and bought one. I have been researching for two weeks about how to use it. What i want to do is control a 4wd home made Rc with a pan and tilt turret on top. I want to use a ps2 controller and use wireless xbees. I have already used the psx2 code, and got the controller working. So im have a problem trying to learn how to get the arduino uno to output to transistors so i can run motors and servos with the joy sticks. I know to makes the circuits for the motors with transistors and what not. Basically i want the left joy stick to drive foward,back,left,and right, and the right joy stick to pan and tilt some servos tied togeather. Ill be using four motors the drive each wheel. I need some help with adding to the psx2 program to make this happen. Any help would be great thanks!

What range were you thinking of for the XBees? I ask this because you can get cheap wireless PS2 controllers, range about 5m, and they
are compatible with standard DualShock controller (and don't even need 7.6V motor power). Solves the remote control problem nicely.

The range i was looking is about a 1.5 miles. I was thinking of using the 900Mhz Xbee's, best bang for the buck, that i could find. I was about to buy a book on programming but i actually just got laid off work today, without any kind of notice. So i'm basically in panic mode now, I'm a auto technician. But I'm not giving up yet!!!

Ah, ahem, a bit more than 5m then!

You mention servos - any device with RC servo compatible control just needs a single pin, use the Servo library...