Hello there,
I spent a lot of time without success to found a solution for this:
The first thing that my sketch do is read a digital pin to know which mode user wants to run. IE:
if (digitalRead(x) = 0) = mode_A
or
if (digitalRead(x) = 1) = mode_B
Ok
If "mode_A" is selected, I need to use <Servo.h>. No problem, I can include it a "if" in Setup{} section.
If "mode_B" is selected, I need to use the "ISR(TIMER1_COMPA_vect)" vector. With multiple variables.
Servo library cannot be used at the same time with "ISR(TIMER1_COMPA_vect)" because both use TIMER1.
Note1: "mode_A" does not need to redefine ISR vector and "mode_B" does not need to use servo library.
Note2: My "mode_A" sketch works well and my "mode_B" sketch works well too. I need to put it together with the digitalRead mode selection.
Note3: I use Pro Mini equivalent à 8MHZ.
I tried ServoTimer2 library but it is made for 16Mhz speed and my skill in library and Timers is not enough good. :o
I tried to put ISR function in a library but with 4-5 variables to pass, it is hard for me. And I read some posts with conditional "include" problem in IDE.
Thank a lot for your help!