1

I am having this problem when trying to compile my sketch. I am using RF frequency modules to send data between devices and a servo motor to control the tilt of a ramp. I understand that both libraries use TIMER 1 but I am unsure how to change one of them to use TIMER 2 thanks.

Arduino: 1.8.7 (Windows 10), Board: "Arduino/Genuino Uno"
libraries\Servo\avr\Servo.cpp.o (symbol from plugin): In function `ServoCount':
(.text+0x0): multiple definition of `__vector_11'
libraries\RadioHead\RH_ASK.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.
Board at COM4 is not available
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
AltAir
5424 silver badges15 bronze badges
asked Mar 9, 2019 at 23:49
0

3 Answers 3

1

You can force the RadioHead library to use Timer 2 instead. This can be done by enabling the define RH_ASK_ARDUINO_USE_TIMER2 near the top of RH_ASK.cpp.

More details about how to do this may be found in the RadioHead library documentation. Please see https://www.airspayce.com/mikem/arduino/RadioHead/classRH__ASK.html.

Cheers!

answered Mar 12, 2019 at 11:14
1

Mikael Patel pretty much gave the answer but I want to be more precise with it.

In your Arduino libraries folder (C:\Users[USER_NAME]\Documents\Arduino\libraries\RadioHead) there is a file called "RH_ASK.cpp" where you have to insert this line:

#define RH_ASK_ARDUINO_USE_TIMER2

You can open the cpp file with Notepad. I added the line between "include <RHCRC.h>" and "#ifndef SAMD51" and it worked for me.

I know it's an old post, but the previous answer didn't help me yesterday, so I hope this help someone in the future as well.

answered Apr 4, 2024 at 22:19
0

You can also use the ServoTimer2 library to move the servos to timer 2 if you'd prefer that.

https://github.com/nabontra/ServoTimer2

answered Apr 4, 2024 at 22:41

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.