I want to control an electronic speed controller using the Servo library. If I just do this it works perfectly fine. The problem is I want to control the motors on the ESC with radios. For that I am using the RadioHead library with on its one also works perfectly fine. As soon as I combine those two this error pops up when compiling:
C:\Users\finnk\AppData\Local\Temp\arduino\sketches\B8377D9F02F93FB3E92431AE5C71C0E6\libraries\RadioHead\RH_ASK.cpp.o (symbol from plugin): In function `RH_ASK::maxMessageLength()':
(.text+0x0): multiple definition of `__vector_11'
C:\Users\finnk\AppData\Local\Temp\arduino\sketches\B8377D9F02F93FB3E92431AE5C71C0E6\libraries\Servo\avr\Servo.cpp.o (symbol from plugin):(.text+0x0): first defined here
I tried this the problem is because it's brushless motors I need to change the maximum and minimum angle. in the normal Servo you can use this function while attaching the Motors: servo.attach(int pin, int minAngle, int maxAngle); if I use the ServoTimer2 library I get this error message: undefined reference to ServoTimer2::attach(int, int, int)';` it seems I can only use the normal attach function which has 0 and 180 as it's angles. Do you maybe know how to do this with the ServoTimer2 library?
//#include <Servo.h>
#include <ServoTimer2.h>
#define value 70
ServoTimer2 m1;
ServoTimer2 m2;
ServoTimer2 m3;
ServoTimer2 m4;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
Serial.println("setup");
delay(2000);
m1.attach(10,1000,2000);
Serial.println("attached Motor 1");
m2.attach(9,1000,2000);
Serial.println("attached Motor 2");
m3.attach(6,1000,2000);
Serial.println("attached Motor 3");
m4.attach(5,1000,2000);
Serial.println("attached Motor 4");
Serial.println("start calibration");
for(int powM = 0; powM <= 180 ; powM++){
m1.write(powM);
m2.write(powM);
delay(10);
}
Serial.println("max value reached -- phase 1 completed");
delay(2000);
for(int powM = 180; powM >= 0; powM--){
m1.write(powM);
m2.write(powM);
m3.write(powM);
m4.write(powM);
delay(10);
}
Serial.println("min value reached -- phase 2 completed");
delay(2000);
Serial.println("setup/calibration completed");
Serial.println("start m1");
m1.write(value);
Serial.println("start m2");
m2.write(value);
Serial.println("start m3");
m3.write(value);
Serial.println("start m4");
m4.write(value);
}
void loop() {
// put your main code here, to run repeatedly:
/*m1.write(val);
Serial.println(val, DEC);
if (val > 10)
val -= 5;
delay(5000);
m1.write(0);
delay(3000);*/
}
And this is the full error message to that code:
C:\Users\finnk\AppData\Local\Temp\ccNuufqB.ltrans0.ltrans.o: In function `setup':
D:\Dokumente\Arduino\Komponente\esc\escKalibration/escKalibration.ino:16: undefined reference to `ServoTimer2::attach(int, int, int)'
D:\Dokumente\Arduino\Komponente\esc\escKalibration/escKalibration.ino:18: undefined reference to `ServoTimer2::attach(int, int, int)'
D:\Dokumente\Arduino\Komponente\esc\escKalibration/escKalibration.ino:20: undefined reference to `ServoTimer2::attach(int, int, int)'
D:\Dokumente\Arduino\Komponente\esc\escKalibration/escKalibration.ino:22: undefined reference to `ServoTimer2::attach(int, int, int)'
collect2.exe: error: ld returned 1 exit status
exit status 1
Compilation error: exit status 1
now to my original problem...
the code:
#include <Servo.h>
#include <RH_ASK.h>
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}
the error:
C:\Users\finnk\AppData\Local\Temp\arduino\sketches\B8377D9F02F93FB3E92431AE5C71C0E6\libraries\RadioHead\RH_ASK.cpp.o (symbol from plugin): In function `RH_ASK::maxMessageLength()':
(.text+0x0): multiple definition of `__vector_11'
C:\Users\finnk\AppData\Local\Temp\arduino\sketches\B8377D9F02F93FB3E92431AE5C71C0E6\libraries\Servo\avr\Servo.cpp.o (symbol from plugin):(.text+0x0): first defined here
collect2.exe: error: ld returned 1 exit status
exit status 1
Compilation error: exit status 1
I think the Haven-Lau library has the same defect as the nabontra version.
The .h file show two functions for .attach()
attach(pin ) - Attaches a servo motor to an i/o pin.
attach(pin, min, max ) - Attaches to a pin setting min and max values in microseconds
But the .cpp file only contains the function for
uint8_t ServoTimer2::attach(int pin)
{
It's very unfortunate that there is no version of ServoTimer2 available through the library manager, and not all the versions found on GitHub are drop in compatible with the original Margolis
Servo.h library