Hi
i also want to do the same thing, currently i am able to do this without the help of an xbee, but since i am looking for a wireless control of the robot
eg: 'w' moves forward
'a' moves left
'd' moves right
'x' moves back
's' stops
i am posting the code for controlling it on the arduino, but i am not sure as to how i should split this code for the receiver and the sender ends
could anyone please help ![]()
thanks
int EN1 = 6;Â
int EN2 = 5;Â //Roboduino Motor shield uses Pin 9
int IN1 = 7;
int IN2 = 4; //Latest version use pin 4 instead of pin 8
Â
void Motor1(int pwm, boolean reverse)
    {
     analogWrite(EN1,pwm); //set pwm control, 0 for stop, and 255 for maximum speed
    if(reverse)
    {
     digitalWrite(IN1,HIGH); Â
    }
    else
    {
     digitalWrite(IN1,LOW); Â
    }
    }Â
   Â
void Motor2(int pwm, boolean reverse)
    {
     analogWrite(EN2,pwm);
    if(reverse)
    {
     digitalWrite(IN2,HIGH); Â
    }
    else
    {
     digitalWrite(IN2,LOW); Â
    }
    }Â
   Â
void setup()
{
  int i;
 // for(i=6;i<=9;i++) //For Roboduino Motor Shield
 // pinMode(i, OUTPUT); //set pin 6,7,8,9 to output mode
  for(i=4;i<=7;i++) //For Arduino Motor Shield
  pinMode(i, OUTPUT); //set pin 4,5,6,7 to output mode
  Serial.begin(9600);Â
}
void loop()
{
 int x,delay_en;
 char val;
 while(1)
 {
  val = Serial.read();
  if(val!=-1)
   {
     switch(val)
     {
      case 'w'://Move ahead
            Motor1(255,true); //You can change the speed, such as Motor(50,true)
            Motor2(255,true);
          Â
            break;
      case 'x'://move back
            Motor1(255,false);
            Motor2(255,false);
            break;
      case 'a'://turn left
            Motor1(255,false);
            Motor2(255,true);
            break;  Â
      case 'd'://turn right
            Motor1(255,true);
            Motor2(255,false);
            break;Â
       case 's'://stop
            Motor1(0,false);
            Motor2(0,false);
            break;
                Â
     } Â
   Â
   }
     Â
 }            Â
}