Radio-Control Con RF 433 Mhz

Buenas compañeros de arduino, esta vez tengo un problema al entender como funciona la libreria
virtual_wire y como usarla para controlar un carrito via RF 433Mhz
pues bueno la logica es como cualquiera,Botones: Arriba Abajo Izquierda Derecha
*Que se puedan combinar arriba y izquierda o derecha.
*Que se puedan combinar abajo y izquierda o derecha.
para eso la logica me llevo a investigar lo de los puentes "H" y eh dado con usar el L293D
un doble puente H.....
pero bueno mi problema consiste en que mi codigo que segun yo deberia funcionar, en pruebas
no realiza las funciones, se que esta mal pero no comprendo como hacer que mande dos estados
y que el receptor los ponga en funcion a la vez aqui mi codigo,
TRANSMISOR

//TRANSMISOR
#include <VirtualWire.h>  //incluimos la libreria de virtualwire
char *msg = "";           //Asignamos el mensaje en blanco
char *msg2 = "";
char *msg3 = "";
char *msg4 = "";
int botonUp = 11;               //Asignamos el estado del boton en 0
int botonDown = 10;
int botonLeft = 9;
int botonRight = 8;

void setup(){
  vw_setup(2000);            //Configuramos la velocidad de transimsion de datos
  pinMode(botonUp, INPUT);
  pinMode(botonDown, INPUT);
  pinMode(botonLeft, INPUT);
  pinMode(botonRight, INPUT);
}

void loop () {
 // botonUp = digitalRead(boton1);    //Leemos el estado del boton y lo guardamos en la variable
  if ( digitalRead (botonUp) == HIGH) {
    msg = "U";                //Si lo esta, asignamos la letra U al mensaje
    vw_send((uint8_t *)msg, strlen(msg));  //y enviamos este mensaje
  }
  else {                      //Si no lo esta
    msg = "V";                //Asignamos N al mensaje
    vw_send((uint8_t *)msg, strlen(msg));    // y lo enviamos
    
  }
  
  if ( digitalRead (botonDown) == HIGH) { 
    msg2 = "D";
    vw_send((uint8_t *)msg2, strlen(msg2));
  }
  else { 
    msg2 = "E";
    vw_send((uint8_t *)msg2, strlen(msg2)); 
    
  }
   if ( digitalRead (botonLeft) == HIGH) {
    msg3 = "L";
    vw_send((uint8_t *)msg3, strlen(msg3));
  }
  else {
    msg3 = "M";
    vw_send((uint8_t *)msg3, strlen(msg3));
    
  }
   if ( digitalRead (botonRight) == HIGH) {
    msg4 = "R";
    vw_send((uint8_t *)msg4, strlen(msg4));
  }
  else {
    msg4 = "S";
    vw_send((uint8_t *)msg4, strlen(msg4));
    
  }
}

RECEPTOR

#include <VirtualWire.h>  //incluimos la libreria de virtualwire

int motorMas = 10;
int motorMenos = 9;
int ladoMas = 8;
int ladoMenos  = 7;

void setup() {
  vw_setup(2000);        //Seleccionamos la velocidad de transmision de datos
  vw_rx_start();         //Iniciamos la comunicación
  pinMode(motorMas, OUTPUT);
  pinMode(motorMenos, OUTPUT);
  pinMode(ladoMas, OUTPUT);
  pinMode(ladoMenos, OUTPUT);
  
}

void loop(){
  uint8_t msg[VW_MAX_MESSAGE_LEN];    
  uint8_t len = VW_MAX_MESSAGE_LEN;

  if (vw_get_message(msg, &len)){  //Condicion para ver si hay mensaje
  if ( msg[0] == 'U') {            //Si el mensaje es una U
  digitalWrite(motorMas, HIGH); digitalWrite(motorMenos,LOW);
  }
  else if (msg[0] == 'N'){         // Si es una N
  digitalWrite(motorMas, LOW); digitalWrite(motorMenos,LOW);
  }
}

if (vw_get_message(msg, &len)){
  if ( msg[0] == 'D') {
  digitalWrite(motorMas, LOW); digitalWrite(motorMenos,HIGH);
  }
  else if (msg[0] == 'E'){
  digitalWrite(motorMas, LOW); digitalWrite(motorMenos,LOW);
  }
}

if (vw_get_message(msg, &len)){
  if ( msg[0] == 'L') {
  digitalWrite(ladoMas, HIGH); digitalWrite(ladoMenos,LOW);
  }
  else if (msg[0] == 'M'){
  digitalWrite(ladoMas, LOW);  digitalWrite(ladoMenos,LOW);
  }
}

if (vw_get_message(msg, &len)){
  if ( msg[0] == 'R') {
  digitalWrite(ladoMenos, HIGH); digitalWrite(ladoMas,LOW);
  }
  else if (msg[0] == 'S'){
    digitalWrite(ladoMenos, LOW);digitalWrite(ladoMas,LOW);
  }
}
}

en el codigo del receptor los if con "D" en adelante estan fuera del loop.
Siquierens enviar 2 estados usaria un valor int donde puedes sumar valores. 2,4,8,16,32,64,128..... si envias un 6 es un 2+4. Con hacer un and a 6 te da el resultado incluido. 6 & 2 = 4.

Hola GIGAFLARE

Yo ahora mismo estoy construyendo un robot que funciona exactamente igual que el tuyo. Le metes valores con un joystick , los envías por radiofrecuencia y luego usas un doble puente en h.
Hace poco gracias al foro conseguí hacerlo funcionar. Te dejo aquí mi código si te sirve de ayuda, aunque esta un poco cutre y me falta ajustar los motores.

El código que tu tienes es una forma que funciona pero no la mas eficiente ya que en cuanto quieras hacer algo mas complejo ya no funcionara. Lo que yo hice fue lo siguiente:

Tengo una arduino con los sensores, entonces leo el estado de todos los sensores y los envió en una cadena string. Al llegar a la otra arduino cojo esos valores de esas string y los descompongo en variables, en tu caso 4.

A partir de ahi es como si lo tuvieras los interruptores directamente conectados.

Es un poquillo rapida esta explicacion pero si te interesa estare encantado en ayudarte y poner bien el codigo para que lo puedas usar. Si vas a controlar un carrito te animo a que uses un joystick lo puedes encontrar por 3 euros o incluso menos, prueba en dealxtrem y te quedara mucho mas profesional. Mi código es de dos joystick, lo bueno de esto es que una vez sabes enviar dos variables, sabes enviar las que sean.

Trasmisor (lo mio son potenciometros de 255 cuatro pero tu lo modificas por interruptores de 0 o 1 y funciona igual)

#include <VirtualWire.h>


const int Sensor1Pin = A1;
const int Sensor2Pin = A2;
const int Sensor3Pin = A3;
const int Sensor4Pin = A4; 
const int ledPin = 13;

int Sensor1Data;
int Sensor2Data;
int Sensor3Data;
int Sensor4Data;
char Sensor1CharMsg[17]; 

void setup() {

 // LED 
 pinMode(ledPin,OUTPUT);
 
 // Sensor(s)
 pinMode(Sensor1Pin,INPUT);
 pinMode(Sensor2Pin,INPUT);
 pinMode(Sensor3Pin,INPUT);
 pinMode(Sensor4Pin,INPUT);
 
 // for debuggin
 Serial.begin(9600); 
 
 // VirtualWire setup
 vw_setup(2000);	 // Bits per sec


}

void loop() {
  
  // Read and store Sensor 1 data
  Sensor1Data = analogRead(Sensor1Pin);
  Sensor2Data = analogRead(Sensor2Pin);
  Sensor3Data = analogRead(Sensor3Pin);
  Sensor4Data = analogRead(Sensor4Pin);
  
  sprintf(Sensor1CharMsg, "%d,%d,%d,%d", Sensor1Data, Sensor2Data, Sensor3Data, Sensor4Data);
 // int message[] = (Sensor1Data, Sensor2Data);
  //message.toCharArray(Sensor1CharMsg,(Sensor1CharMsg.lenght()+1));
  // Convert integer data to Char array directly 
  //itoa(Sensor1Data,Sensor2Data,Sensor1CharMsg,10);
  
  // DEBUG
  Serial.print("Sensor1 Integer: ");
  Serial.print("X");
  Serial.print(Sensor1Data);
  Serial.print("Y");
  Serial.print(Sensor2Data);
  Serial.print("X1");
  Serial.print(Sensor3Data);
  Serial.print("Y1");
  Serial.print(Sensor4Data);
  Serial.print("Sensor1Datamsg");
  Serial.println(Sensor1CharMsg);
 

  // END DEBUG
 
digitalWrite(13, true); // Turn on a light to show transmitting
 vw_send((uint8_t *)Sensor1CharMsg, strlen(Sensor1CharMsg));
 vw_wait_tx(); // Wait until the whole message is gone
 digitalWrite(13, false); // Turn off a light after transmission
 delay(2); 

} // END void loop...

Receptor(el codigo lo tengo en dos paginas)

#include <VirtualWire.h>


// This code have extracts from differents tutorials on the web that I used long time ago, so I can remmeber the authors 
#define MOTOR1_CTL1  4  // I1  
#define MOTOR1_CTL2  3  // I2  
#define MOTOR1_PWM   2 // EA  
  
#define MOTOR2_CTL1  7  // I3  
#define MOTOR2_CTL2  6// I4  
#define MOTOR2_PWM   5 // EB  
  
#define MOTOR_DIR_FORWARD  0  
#define MOTOR_DIR_BACKWARD   1



// Sensors 
int Sensor1Data;
int Sensor2Data;
int Servo1;
int Servo2;
// RF Transmission container
char Sensor1CharMsg[17]; 

void setup() {
  Serial.begin(9600);
  
   pinMode(MOTOR1_CTL1,OUTPUT);  
   pinMode(MOTOR1_CTL2,OUTPUT);  
   pinMode(MOTOR1_PWM,OUTPUT);  
     
  // Setup pins for motor 2  
   pinMode(MOTOR2_CTL1,OUTPUT);  
   pinMode(MOTOR2_CTL2,OUTPUT);  
   pinMode(MOTOR2_PWM,OUTPUT);
  // sets the digital pin as output
  pinMode(13, OUTPUT);
  
 
    // VirtualWire 
    // Initialise the IO and ISR
    // Required for DR3100

    // Bits per sec
    vw_setup(2000);
    vw_set_rx_pin(11);	 
    
    // Start the receiver PLL running
    vw_rx_start();       

} // END void setup

void loop(){
    uint8_t buf[VW_MAX_MESSAGE_LEN];
    uint8_t buflen = VW_MAX_MESSAGE_LEN;
    
//Taking the data from the control base
    if (vw_get_message(buf, &buflen)) 
    {
	int i;
        // Turn on a light to show received good message 
        digitalWrite(13, true); 
	
        // Message with a good checksum received, dump it. 
        for (i = 0; i < buflen; i++)
	{            
          // Fill Sensor1CharMsg Char array with corresponding 
          // chars from buffer.   
          Sensor1CharMsg[i] = char(buf[i]);
	}

      sscanf(Sensor1CharMsg, "%d,%d,%d,%d",&Sensor2Data, &Sensor1Data,&Servo1,&Servo2); // Convierte un string en un array
        
        // Turn off light to and await next message 
        digitalWrite(13, false);
    }

// Control the motors 
 if (Sensor1Data > 700){
   int v1 = 255;
  motorStart(1, MOTOR_DIR_FORWARD);    
  setSpeed(1, v1);  
  motorStart(2, MOTOR_DIR_FORWARD);        
  setSpeed(2, v1);  
  delay(2); 
  }
  
 if (Sensor1Data < 300){ 
   int v2 = 255;//
   
   motorStart(1, MOTOR_DIR_BACKWARD);    
   setSpeed(1, v2);  
   motorStart(2, MOTOR_DIR_BACKWARD);        
   setSpeed(2, v2);  
   delay(2); 
    }
 if(300<Sensor1Data<700 && 300 < Sensor2Data < 700){
    motorStop(1);
    motorStop(2);
    }

if(300<Sensor1Data<700){
    if (Sensor2Data > 700){

       motorStart(2, MOTOR_DIR_FORWARD);    
       setSpeed(1, 255);  
       motorStart(1, MOTOR_DIR_BACKWARD);        
       setSpeed(2, 255);  
       delay(2);
       }
  
    if (Sensor2Data < 300){ 
      
       motorStart(2, MOTOR_DIR_BACKWARD);     
       setSpeed(1, 255);  
       motorStart(1, MOTOR_DIR_FORWARD);        
       setSpeed(2, 255);
       delay(2); 
       }
     }
//End controling the motors 
//cabezamovil();
 memset( Sensor1CharMsg, 0, sizeof( Sensor1CharMsg));// This line is for reset the Sensor1CharMsg
}

Pestaña 2

void setSpeed(char motor_num, char motor_speed)  
{  
   if (motor_num == 1)  
   {  
      analogWrite(MOTOR1_PWM, motor_speed);  
   }     
   else  
   {  
      analogWrite(MOTOR2_PWM, motor_speed);  
   }  
}  
  
void motorStart(char motor_num, byte direction)  
{  
    
   char pin_ctl1;  
   char pin_ctl2;  
     
   if (motor_num == 1)  
   {  
      pin_ctl1 = MOTOR1_CTL1;  
      pin_ctl2 = MOTOR1_CTL2;  
   }     
   else  
   {  
      pin_ctl1 = MOTOR2_CTL1;  
      pin_ctl2 = MOTOR2_CTL2;       
   }  
    
   switch (direction)  
   {  
     case MOTOR_DIR_FORWARD:  
     {  
       digitalWrite(pin_ctl1,LOW);  
       digitalWrite(pin_ctl2,HIGH);            
     }  
     break;   
            
     case MOTOR_DIR_BACKWARD:  
     {  
        digitalWrite(pin_ctl1,HIGH);  
        digitalWrite(pin_ctl2,LOW);            
     }  
     break;           
   }  
}  
  
void motorStop(char motor_num)  
{  
   setSpeed(motor_num, 0);  
   if (motor_num == 1)  
   {  
     digitalWrite(MOTOR1_CTL1,HIGH);  
     digitalWrite(MOTOR1_CTL2,HIGH);       
   }  
   else  
   {  
     digitalWrite(MOTOR2_CTL1,HIGH);  
     digitalWrite(MOTOR2_CTL2,HIGH);       
   }  
}