novato autodidacta pidiendo ayuda para trasladar ordenes a motores.

Hola, pues eso me presento: soy jose, un novato autodidacta, y estoy empezando (despues de hacer ejercicios con los led), a controlar un robot con la direccion tipo tanque, con un joystick, he encontrado un codigo, que lo he probado y si que leo las lecturas del joystick's pero no veo la forma de pasar esta esta lectura a los motores, por favor una ayudita diciendome donde mirar (pero que sea muy sencillo que estoy empezando) o explicarme como crear el motor cc y governarlo, a ver si tengo mas suerte que con otro post que dejé nadie me pudo contestar (ya esta borrado). por favor contestarme aunque sea para decirme que me olvide de este proyecto, muchas gracias.
el codigo es para enviarlo via xbee, pero primero quiero empezar en la misma placa y mas adelante me complicare os dejo el codigo:

//this code reads from the inputshield's joystics, and forwards the message to the xbee sensor on the remote

//Remote Arduino Reads the analog values of the joystick->
//Remote Arduino translates the signal meaning and creates commands ->
//Remote Arduino Serial Port ->
//Remote Xbee Shield ->
//Tank Xbee Shield ->
//Tank Arduino Forwards the signal to pins 12,13 ->
//TankShield pin 12, 13 reads command and controls motors

void setup()
{
Serial.begin(9600);
digitalWrite(4, HIGH); pinMode(4, INPUT);
digitalWrite(5, HIGH); pinMode(5, INPUT);
}

unsigned int V1;
unsigned int L1;
long LEFT = 255;
long RIGHT = 255;
long Throttle; //forwards is positive, reverse is negative
long Percent; //percentage of power given to the right side

void loop()
{

///////////////////////////////////////////////////////////////
//Read JOY Position
///////////////////////////////////////////////////////////////
L1 = analogRead(5);//Joy latteral read analog value (1023 is the most left position and 0 is the most right position
V1 = analogRead(4);//Joy vertical read analog value (1023 is the most up/forward position and 0 is the most down/reverse position)

Percent = L1 + 1; //add 1 so I never have to divide by zero 0
Percent = Percent * 100; //scale up the value to apply a ratio to the "RIGHT" and "LEFT"
Percent = (Percent/1024); //divide by the most possible value (all the way right)

///////////////////////////////////////////////////////////////
//TEST JOY Position and calculate respective direction
///////////////////////////////////////////////////////////////

if (V1>600 & Percent<60 & Percent>40)//Forward
{
RIGHT = 255;
LEFT = 255;
}
else if (V1>600 & Percent<96 & Percent>59)//Forward but left
{
RIGHT = 255;
LEFT = (150-Percent)255;
LEFT = LEFT/100;
}
else if (V1>600 & Percent<41 & Percent>4)//Forward but right
{
RIGHT = (Percent+50)255;
RIGHT = RIGHT/100;
LEFT = 255;
}
else if (V1<400 & Percent<60 & Percent>40)//Reverse
{
RIGHT = -255;
LEFT = -255;
}
else if (V1<400 & Percent<96 & Percent>59)//Reverse but left
{
RIGHT = -255;
LEFT = (150-Percent)
(-255);
LEFT = LEFT/100;
}
else if (V1<400 & Percent<41 & Percent>4)//Reverse but right
{
RIGHT = (Percent+50)
(-255);
RIGHT = RIGHT/100;
LEFT = -255;
}
else if (V1>399 & V1<601 & Percent>80)//Sharp left turn
{
RIGHT = +255;
LEFT = -255;
}
else if (V1>399 & V1<601 & Percent<20)//Sharp right turn
{
RIGHT = -255;
LEFT = +255;
}
else //stop
{
RIGHT = 0;
LEFT = 0;
}

// Remote Arduino Serial Port ->
//Remote Xbee Shield ->
//Tank Xbee Shield ->
//Tank Arduino ->
//TankShield pin 12, 13

// command structure is:
//"THROTTLE|left-gear-box|right-gear-box;"
Serial.print("THROTTLE|"); //print the throttle command to the serial port
Serial.print(RIGHT);
Serial.print("|");
Serial.print(LEFT);
Serial.print(";");

delay(100);//give time for the XBee transfer
}

podria poner mas info sobre el control y el tipo de motores que usas?.

suponiendo que tu control son dos potenciometro.
tendrias q saber cual es el rando del mismo.de ahi dividirlo en dos asi te queda para anbas direciones (right y left)
lo mismo con el otro ponteciometro.
de ahi podrias hacer un mapeo funcion map(). , es decir que ese rango se convierta por ejemplo aun rango aceptable
para le velicodad del motor y de ahi enviar esa info a los motores.

funcion map http://arduino.cc/es/Reference/Map

leer datos del ponteciometro

void setup() {
  Serial.begin(9600);
}

void loop() {
  int sensorValue = analogRead(A0);
  Serial.println(sensorValue);
}

veo que tienes los motores conectdos a los pines 12 y 13, lo unico que podras hacer es prender y apagrlos.no podras varial la velocidad de los mismos.

mirate esto-talvez te oriente-

L293D + Arduino + DC Motor

Arduino DC Motor Control

en el caso que tengas un motor dc aqui la info
http://itp.nyu.edu/physcomp/Labs/DCMotorControl
http://translate.google.es/translate?sl=en&tl=es&js=n&prev=_t&hl=es&ie=UTF-8&layout=2&eotf=1&u=http%3A%2F%2Fitp.nyu.edu%2Fphyscomp%2FLabs%2FDCMotorControl&act=url

muchas gracias por la rapida respuesta, estoy utilizando un joystick desguazado de un mando de playstation 2, las lecturas las tengo y son correctas, voy a estudiarme lo que me has dicho y veremos que sale, pero es que soy un poco ceporro, y me costara enterarme. muchas gracias y ya contestare cuando lo tenga claro o me lie del todo XD

solucionado, he optado por otro codigo que encontre y que funcionaba, ahora a estudiar. jajajajaja. XD