I am attempting a project where I use a feather 32u4 to control a servo. It is controlled using the buttons on an attached oled featherwing to set the servo to 3 different values. The code that was provided to me produces an error for this board. After messing with similar code, it appears the statement #include <Servo.h> produces an error. There is also a note in the messages about Wire.h but that appears to not be a problem any other time.

The error messages are as follows:

Arduino: 1.6.13 (Mac OS X), Board: "Adafruit Feather 32u4"

libraries/Servo/avr/Servo.cpp.o (symbol from plugin): In function `ServoCount':
(.text+0x0): multiple definition of `__vector_17'
libraries/RadioHead-master/RH_ASK.cpp.o (symbol from plugin):(.text+0x0): first defined here
collect2: error: ld returned 1 exit status
Multiple libraries were found for "Wire.h"
 Used: /Users/bsd194.lab102/Library/Arduino15/packages/adafruit/hardware/avr/1.4.13/libraries/Wire
 Not used: /Applications/Arduino.app/Contents/Java/hardware/arduino/avr/libraries/Wire
exit status 1
Error compiling for board Adafruit Feather 32u4.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

I would attach the code but I don't know how to post it without it appearing oddly.


1 Answer 1


The message multiple definition of __vector_17 means, that in your code the interrupt vector 17 is defined multiple times. Often this happens, because 2 used libraries use the same hardware peripherals like the timers. Only one library can configure and use the hardware. If 2 try it, you get a compiler error.

On the Atmega32u4 the interrupt with number 17 is the TIMER1 CAPT (Capture interrupt of Timer1)(see the datasheet of the Atmega32u4, chapter "Interrupts"). The error message says, that the Servo library and the RadioHead library both define this interrupt. They both try to use the hardware Timer1.

The consequence is, that you cannot simply use these two libraries together. So what to do? This can get rather difficult. You could change one of the libraries to use a different timer (the Atmega32u4 has 4 timers). This may involve extensive changes (mostly changing the register names, but sometimes more complex changes, if the new timer is not the same type). Some libraries directly provide the possibility to use a different timer, but most don't. Fortunate for you, the RadioHead library provides a simple way to change the used timer to Timer2, tough you cannot simply do this, since on the 32u4 the next 16bit Timer is Timer3. This Adafruit forum thread mentions how to set the RadioHead library for Timer2 (by uncommenting the define RH_ASK_ARDUINO_USE_TIMER2 in RH_ASK.cpp) and give a hint on how to then change to Timer3: Effectively by Changing all the 2s in the timer register and bit names to 3s. To be sure please check everytime, that the corresponding register/bit names really exist (you can see this in the register descriptions in the datasheet).

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.