hello guys ^^
so i made a car that i want to control using my mobile , i send the command using bluetooth to the 1st arduino and then the first arduino sends it to the car using rf links , after finishing the the code when i compile the code it gives me this massage :
Error compiling
Servo\Servo.cpp.o: In function __vector_11': C:\Program Files (x86)\Arduino\libraries\Servo/Servo.cpp:103: multiple definition of __vector_11'
VirtualWire\VirtualWire.cpp.o:C:\Program Files (x86)\Arduino\libraries\VirtualWire/VirtualWire.cpp:568: first defined here
here's the code :
#include <VirtualWire.h>
#include <Servo.h>
Servo myservo;
int pos = 0;
int relay1 = 4; //back wheel power switch
int relay2 = 6; //back wheel forward (1) / backward (0) switch
boolean val1=0;
boolean val2=0;
void setup() {
vw_set_ptt_inverted(true); // Required for DR3100
vw_set_rx_pin(7);
vw_setup(4000); // Bits per sec
myservo.attach(9);
pinMode(relay1, OUTPUT);
pinMode(relay2, OUTPUT);
pinMode(10,OUTPUT);
digitalWrite (10,1);
digitalWrite (relay1,0);
digitalWrite (relay2,0);
vw_rx_start(); // Start the receiver PLL running
}
void loop() {
uint8_t buf[VW_MAX_MESSAGE_LEN];
uint8_t buflen = VW_MAX_MESSAGE_LEN;
if (vw_get_message(buf, &buflen)) {
if(buf[0]=='0'){
if (val1 == 0){
digitalWrite (relay1, 1);
digitalWrite (relay2, 1); //car moves forward
val1 = 1;
}
else {
digitalWrite (relay1, 0);
val1 = 0;
}
}
if(buf[0]=='1'){
if (val1==0){
digitalWrite (relay1, 1);
digitalWrite (relay2, 0); //car moves backward
val1 = 1;
}
else {
digitalWrite (relay1, 0);
val1 = 0;
}
}
if(buf[0]=='2'){
pos=90;
myservo.write(pos);
}
if(buf[0]=='3'){
pos=-90;
myservo.write(pos);
}
if(buf[0]=='4'){
pos=0;
myservo.write(pos);
}
}
}