how to make a potentiometer control a dc motor via wireless RF links?

hello guys,
i need please to have some tips on how to program a potentiometer that controls a DC motor via RF links ?
here is the program which i wrote so far but i am sure it's all wrong it didn't work !! i need to know how to convert the signal from potentiometer to send it by the transmitter ?

// TRANSMITTER CODE

#include <VirtualWire.h>

int potPin = A0;
const char *motorOn = "a"; //28
const char *motorOn1 = "b"; //50
const char *motorOn2 = "c"; //100
const char *motorOn3 = "d"; //150
const char *motorOn4 = "e"; //200
const char *motorOn5 = "f"; //255

void setup()
{
Serial.begin(9600);
while (! Serial);
Serial.println("Speed 0 to 255");

vw_setup(2400); // Bits per sec
vw_set_tx_pin(12);
}
void loop()
{
int val = map(analogRead(potPin), 0, 1023, 0, 255);
if(val <= 28){
vw_send((uint8_t *)motorOn, strlen(motorOn));
vw_wait_tx();
Serial.println(val);
}
else if(val <= 55){
vw_send((uint8_t *)motorOn1, strlen(motorOn1));
vw_wait_tx();
Serial.println(val);
}
else if(val <= 100){
vw_send((uint8_t *)motorOn2, strlen(motorOn2));
vw_wait_tx();
Serial.println(val);
}
else if(val <= 150){
vw_send((uint8_t *)motorOn3, strlen(motorOn3));
vw_wait_tx();
Serial.println(val);
}
else if(val <= 200){
vw_send((uint8_t *)motorOn4, strlen(motorOn4));
vw_wait_tx();
Serial.println(val);
}
else if(val <= 255){
vw_send((uint8_t *)motorOn5, strlen(motorOn5));
vw_wait_tx();
Serial.println(val);
}
}

and this for the receiver :

// RECEIVER CODE

#include <VirtualWire.h>

int motorPin = 3;

void setup()
{
pinMode(motorPin, OUTPUT);
Serial.begin(9600);

while (! Serial);
Serial.println("Speed 0 to 255");

vw_setup(2000);
vw_set_rx_pin(3);
vw_rx_start();
}
void loop()
{
uint8_t buflen = VW_MAX_MESSAGE_LEN;
uint8_t buf[buflen];

if(vw_get_message(buf, &buflen))
{
//int val = map(analogRead(potPin), 0, 1023, 0, 255);

for(int i = 0; i < buflen; i++)
{
if(buf == 'a')

  • {*
  • analogWrite(motorPin, 28);*
  • }*
    _ else if(buf == 'b')_
    * {*
    * analogWrite(motorPin, 55);*
    * }*
    _ else if(buf == 'c')
    * {
    analogWrite(motorPin, 100);
    }
    else if(buf == 'd')
    {
    analogWrite(motorPin, 150);
    }
    else if(buf == '4')
    {
    analogWrite(motorPin, 200);
    }
    else if(buf == '5')
    {
    analogWrite(motorPin, 255);
    }
    }
    }*_

}

i need please to have some tips on how to program a potentiometer that controls a DC motor via RF links ?

Is that a statement or a question? If it is a question, what is the question?

The code does something. What does it do?

You want it to do something? How is that different from what it does?

thanks for your concern i donno what i was thinking when i posted this one here !! i'm sorry :S
problem has been solved and i didn't get any notice of a reply on my email !!

Hii! I am making a hovercraft...can anyone pls post the code and the connections for controlling DC Motor speed and servo control via RF?

can anyone pls post the code and the connections for controlling DC Motor speed and servo control via RF?

You know, an awful lot depends on which motor shield you have and which kind of RF.