Encoder.h (by PaulStoffregen) attaching other interrupts while using ENCODER_OPTIMIZE_INTERRUPTS

I'm trying to use the Encoder.h library with ENCODER_OPTIMIZE_INTERRUPTS and trying to attach an interrupt on another pin for something else. I get the following use while trying to compile:

WInterrupts.c.o (symbol from plugin): In function `attachInterrupt':
(.text+0x0): multiple definition of `__vector_1'
C:\Users\olive\AppData\Local\Temp\arduino\sketches\133974FCF347CA1C7E898EB3EF20E6FD\sketch\mitLibrary_hauptellenrezahl.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here
WInterrupts.c.o (symbol from plugin): In function `attachInterrupt':
(.text+0x0): multiple definition of `__vector_2'
C:\Users\olive\AppData\Local\Temp\arduino\sketches\133974FCF347CA1C7E898EB3EF20E6FD\sketch\mitLibrary_hauptellenrezahl.ino.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 don't get the Issue with USE and DO NOT USE interrupts

I'm using an Arduino Uno.

Please post your code, using code tags.

The point of ENCODER_OPTIMIZE_INTERRUPTS is that it defines the interrupt service routines directly, without using attachInterrupt.
If you do that, you cannot define other ISRs for external interrupts or use attachInterrupt.

In conclusion, don't use ENCODER_OPTIMIZE_INTERRUPTS if you want to be able to attach other external interrupts.

oh didn't know that. Thank you!!

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.