Simple RF System for controlling Rover

Hi All.

I am trying to create a Controller for my Rover.

I have a base control aspect set-up using he following commands:

X1 Analog Joystick:
xAxis = Home:0, Left:1, Right:2
yAxis = Home:0, Forward:1, Reverse:2

Outputing: 0,1 = Drive Forward

const int xAxis_pin= 1;
const int yAxis_pin=0;

int xAxis_val;
int xAxis_cmd;

int yAxis_val;
int yAxis_cmd;

int button_A= 5;
int button_B= 3;
int button_C= 4;

int LED = 13;

void setup(){
  int i;
    pinMode(i, INPUT);

void loop(){
    if(digitalRead(button_B)==0) //Throtte iniiated
      xAxis_val=analogRead(xAxis_pin); //Read Analog input
      if(xAxis_val==511){ //home
      else if(xAxis_val<=500) {   // Right
        xAxis_cmd = 2; 
      else if(xAxis_val>=515){ // Left
        xAxis_cmd = 1; 

        //up/down  home
        yAxis_cmd = 0;
      else if(yAxis_val<=530) {   // up
        yAxis_cmd = 1; 
      else if(yAxis_val>=540){ // down
        yAxis_cmd = 2; 
      digitalWrite(LED, HIGH); 
      Serial.print(xAxis_cmd); // Left & Right
      Serial.println(yAxis_cmd); // Up & Down

    else digitalWrite(LED,LOW);

I now want to transmit the int values via a 433MHZ Transmitter and then use those int values on the receiver end.

VirualWire requires the input to be a char value which require conversion on both side.

Are there any suggestions for an alternative?


Since xAxis_cmd and yAxis_cmd are limited to byte sized values, they should be declared as bytes. Then, Serial.write() can be used to write the byte, rather than converting it to an array of characters, and sending the array.

No conversion would be needed on the receiver.