timers problam

hellow,

I am building a project of painting RF robot.
I got for the robot those compononts:
-servo to put the marker up and down
-motor shield to control the two DC motors that move the robot
-RF reciver that I use the virtualwire library to get the information from

because I need 4 timers to use those components together I got DFRduino mega
but when I try to use the servo library with the virtualWire library it won't compile
and when I use the servotimer2 library with the virtualWire library the reciver doesn't work properly

I would like to know how can I use all these components together?

by the way I add the code for the servotimer2

#include <VirtualWire.h> // you must download and install the VirtualWire.h to your hardware/libraries folder
#include <ServoTimer2.h>

ServoTimer2 myservo;

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

int dirA = 13;
int dirB = 12;
int speedA = 10;
int speedB = 9;

int mid=1560;
int marker=1520;
int eraser=90;

uint8_t buf[VW_MAX_MESSAGE_LEN];
uint8_t buflen = VW_MAX_MESSAGE_LEN;

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(3); // 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

pinMode (dirA, OUTPUT);
pinMode (dirB, OUTPUT);
pinMode (speedA, OUTPUT);
pinMode (speedB, OUTPUT);
digitalWrite (dirA, LOW);
digitalWrite (dirB, LOW);
digitalWrite(speedA, LOW);
digitalWrite(speedB, LOW);

myservo.attach(6);
changeServo(0);

}

void changeServo(int situ)
{
if (situ==-1){
myservo.write(eraser);
}
if (situ==0){
myservo.write(mid);
}
if (situ==1){
myservo.write(marker);
}
}

void loop()
{
vw_wait_rx_max(2000);
if (vw_get_message(buf, &buflen)) // check to see if anything has been received
{

Serial.println("here");

Serial.println((int)buf[0]);
Serial.println((int)buf[1]);
Serial.println((int)buf[2]);

if (buf[0]%2==0){
digitalWrite (dirA, LOW);
Serial.println("here1");
}
else{
digitalWrite (dirA, HIGH);
Serial.println("here2");
}

if (((int)buf[0]/2)%2==0){
digitalWrite (dirB, LOW);
Serial.println("here3");
}
else{
digitalWrite (dirB, HIGH);
Serial.println("here4");
}

if (((int)buf[0]/4)%2==0){
changeServo(0);
Serial.println("off");
}
else{
changeServo(1);
Serial.println("on");
}

analogWrite (speedA, (int)buf[1]);
Serial.println("here11");
analogWrite (speedB,(int)buf[2]);
Serial.println("here12");

}
Serial.println("wait");
}

thanks tomer

What compile errors are you getting?

Sorry for the delay
I tried few things but yet no success.

the compile error for the servo library is:
VirtualWire\VirtualWire.cpp.o: In function __vector_17': C:\Users\Tomer\Downloads\arduino-0022\arduino-0022\libraries\VirtualWire/VirtualWire.cpp:412: multiple definition of __vector_17'
Servo\Servo.cpp.o:C:\Users\Tomer\Downloads\arduino-0022\arduino-0022\libraries\Servo/Servo.cpp:103: first defined here

In this case(the given code) I don't get any compile error.
But the RF receiver get only some of the sent messages,
and the DC motors don't work at all.
If I delete the servo attach (the "#include <ServoTimer2.h>" and "ServoTimer2 myservo;" are still in the code)
the receiver and motors works fine.

I would be glad to get some help in this

Tomer

Can someone help me?

Please don't crosspost - http://arduino.cc/forum/index.php/topic,59281.0.html -
remove this thread / or the other(s)
thank you