Compiling Error for potentiometer controlled servo sketch (beginners problems)

Hi all, i bought an Arduino Robot with the control board and motor board and have managed to connect a servo and run a sketch with predetermined movement. Now i want to use the existing potentiometer on the control board to move the servo.My sketch is below, when I compile it gives me the following error:

libraries\Robot_Control\Melody.cpp.o (symbol from plugin): In function __vector_17':* *(.text+0x0): multiple definition of __vector_17'
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
Error compiling for board Arduino Robot Control.

// Include the Servo library 

// include the robot library
#include <Servo.h> 
#include <ArduinoRobot.h>
#include <Wire.h>

// Declare the Servo pin 
// Servo pins connected to D3 on Control Board
// A4 referenced below is D3
// Top to Bottom : Red Yellow Black 5V - Signal - Ground
int servoPin = A4; 
// Create a servo object 
Servo Servo1; 
void setup() { 
// We need to attach the servo to the used pin number 
  Servo1.attach(servoPin); 
}

void loop(){
 int val=map(Robot.knobRead(),0,1023,0,179);
 Servo1.write(val);
 delay(15);
}

I have run a simpler sketch on the arduino uno and it worked just fine, trying to replicate the same on the Arduino Robot control board.

Thanks and please bare with me as I am completely new to all of this and only started a couple days back.

Mahmood

Can you please edit yo post and surround the code and error with separate code-tags? See How to use the forum.

And which IDE do you use? And which OS?

It appears that there is a symbol with the same name in both the servo and arduino_robot libraries called vector_17 which causes the problem.

My guess, the easy fix is that you probably dont need both libraries.

Attach or link to the Robot_Control library so we can examine it. The problem looks like it's in there.

bDeters:
It appears that there is a symbol with the same name in both the servo and arduino_robot libraries called vector_17 which causes the problem.

My guess, the easy fix is that you probably dont need both libraries.

I believe that usually happens when there are two functions declared with the same name in different CPP files. The compiler works fine, and it fails at the linker stage with that cryptic and unhelpful error message.

Actually, I think __vector_17 is the TIMER0_OVF interrupt vector. Who would use that in an Arduino library?

Jiggy-Ninja:
Actually, I think __vector_17 is the TIMER0_OVF interrupt vector. Who would use that in an Arduino library?

Well since its the servo library, a timer for pins that dont have PWM would make sense.

I am using Arduino 1.8.3 on Windows XP OS, sorry about the editing I'm learning as I go!

If i try to remove either library, it gives me more errors back. Servo library seems to not recognize the Robot.knobRead instruction because its on the arduinorobot.h library? I could be way off.

How can i attach/link to Robot_Control library? And the __vector_17 being the TIMER0_OVF interrupt vector, how do i go around it?

Thanks!

bDeters:
Well since its the servo library, a timer for pins that dont have PWM would make sense.

I would expect it to use Timer2, not Timer0. The core uses TIMER0_OVF to make the millis() counter, it's the dumbest interrupt to try and use on an Arduino system.

malsaati:
I am using Arduino 1.8.3 on Windows XP OS, sorry about the editing I'm learning as I go!

If i try to remove either library, it gives me more errors back. Servo library seems to not recognize the Robot.knobRead instruction because its on the arduinorobot.h library? I could be way off.

How can i attach/link to Robot_Control library? And the __vector_17 being the TIMER0_OVF interrupt vector, how do i go around it?

Thanks!

Hit Preview, then under additional options you can attach a file.

You mean attach the files in the library folder? It says on arduino website that the library exists on the 1.0.5 and later IDE.

I got that wrong. The Robot board uses an ATmega32U4, not a 328P. __vector_17 is TIMER1_COMPA.

The Melody and Servo libraries are trying to use the same ISR, which is not possible. You need to make the Servo library use a different timer.

Jiggy-Ninja:
The Melody and Servo libraries are trying to use the same ISR, which is not possible. You need to make the Servo library use a different timer.

How do I do that?

I have read today that I can suppress the 'Melody' part and all its dependencies of the Arduino Robot because the Melody uses the same timer used by the Servo library. But how do I suppress it?

Thanks!