Wireless controll of servo

Hey guys, im trying to control a servo through an 433MHz RF link.
the code:

#include <ServoTimer2.h>
#include <VirtualWire.h>

#undef int
#undef abs
#undef double
#undef float
#undef round

ServoTimer2 servo;

int i = 0;
void setup()
{
Serial.begin(9600);

// Initialise the IO and ISR
vw_set_ptt_inverted(true); // Required for RX Link Module
vw_setup(2000); // Bits per sec
vw_set_rx_pin(0); // We will be receiving on pin 23 (Mega) ie the RX pin from the module connects to this pin.
vw_rx_start(); // Start the receiver
servo.attach(A2);
}

void loop()
{
uint8_t buf[VW_MAX_MESSAGE_LEN];
uint8_t buflen = VW_MAX_MESSAGE_LEN;

if (vw_get_message(buf, &buflen)) // check to see if anything has been received
{
int i;
// Message with a good checksum received.

for (i = 0; i < buflen; i++)
{
Serial.print(buf*); // the received data is stored in buffer*

  • }*
    _ Serial.println("");_
  • }*
    _ else if(buf == 1){_
    * servo.write(0)d*
    * delay (50);*
    * }*
    * else {*
    * servo.write(875);*
    * delay(50);*
    * }*
    _ //else if(buf == 1){[/color]
    * // servo.write(0);
    //}
    //else if(buf == 0){[/color]
    //servo.write(1750);
    //}*_

}
[/quote]
But when i i upload the code to the boarf the servo dosent respond all the time. but the serial print does. can anynone see and error with the code?
Thanks in regards

     for (i = 0; i < buflen; i++)

{
        Serial.print(buf);  // the received data is stored in buffer
        }
    Serial.println("");
     }
     else if(buf == 1){
       servo.write(0)d
       delay (50);
     }
     else {
         servo.write(875);
         delay(50);
       }
  //else if(buf == 1){

This is junk. Specially the buf==1 part.
Also, a delay of 50 ms doesn't give your servo to move very far.

Korman

dunno why it put a d in there. its not in my code :confused:
and the buff == 1 should be buff == 1
but ill try and change the delay (: