0

I have an Arduino Uno and I am trying to control a stepper motor with it. I also have an RF transmitter and receiver (433MHZ). I need to transmit data about motor status.

For RF I am following this page. Individually both are working great. I am able to send data from one Arduino (TX) to another (RX). And also I am able to control the motor. But when I am merging these projects, their header files are giving an error.

For RF, I need to include #include <RH_ASK.h> and for the motor I need include #include <Servo.h>. When I am including these headers files, they are giving me this error:

Arduino: 1.8.1 (Windows 10), Board: "Arduino/Genuino Uno"

libraries\RadioHead\RH_ASK.cpp.o (symbol from plugin): In function `RH_ASK::maxMessageLength()':

(.text+0x0): multiple definition of `__vector_11'

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/Genuino Uno.

I do not know what's wrong here. Can anyone please help me?

3
  • I found the solution on internet. These both libraries cannot be used at the same time. To do it, I downloaded the servotimer2 library but its not even compiling.
    – S Andrew
    Mar 12, 2017 at 14:53
  • That sounds like a nice solution.
    – dannyf
    Jul 11, 2017 at 9:41
  • Please, accept @Jot's answer to close this question.
    – user31481
    Nov 8, 2017 at 7:21

2 Answers 2

2

First of all, that page has a link to an old version of the RadioHead library.
This is a link to RadioHead: www.airspayce.com/mikem/arduino/RadioHead. You will find the newest library on that page.

The Servo library uses TIMER1.
The RadioHead in RH_ASK mode uses TIMER1.
Both use the same interrupt of TIMER1. That is what the compiler is trying to tell you with: "multiple definition of _vector_11".

You could move one of them to TIMER2.
There are alternative Servo libraries that use TIMER2.
The RadioHead can set a define for TIMER2. The explanation is in the library files in RH_ASK.h, you have to set "#define RH_ASK_ARDUINO_USE_TIMER2" in RH_ASK.cpp.

Why are you using the Servo library for a stepper motor ?

0

It is telling you that interrupt vector 11 is being defined multiple times. Such definitions should be done in the source file, not in the header file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.