ServoTimer2 Interrupts and IR-Remotes...


I am just experimenting with a small DIY robot (build of stacked CD-Roms ;-)

I use three servos (two for driving one for the "head") so I use ServoTimer2.

Today I found a IR-Receiver and an old Sony Remote, and tried with the sketches from here:

However, using a Interrupt interferes with the Servos, I suspect ServoTimer2? Using an external Interrupt on Pin2 or 3 leads to erratical servo movements from time to time.

Because of the blocking while reading a RC5 code I also doubt it is possible to get a IR Remote working on my robot at all?

Any suggestions? Carsten :-?


I'm a little confused. The IR receiver you linked to does not use an ISR (it uses pulseIn()). This is not to say it isn't interfering with your servos, and yes, it is blocking.

However, I recently came across a non-blocking IR receiver -

This one does use an ISR (and not pulseIn()).

I've tweaked it to make it less sensitive, but still have a few intermittent false triggers in a sketch that has another ISR. However, it might be worth looking at.

A bit down the thread is a interrupt version (atm I suspect it not beeing very clever).

So I started to experiment with Interrupts and this interferes with the servos.

Can you confirm that ServoTimer2 Lib is not usable with other interrupts?

Thanks for the link!


Oh, I see it now. It just adds an ISR to call GetIRKey(). I tried that and it was pretty funky. (Had doubts about calling a fuc. from an ISR that used pulseIn()) The one I linked to uses an entirely different approach.

Can you confirm that ServoTimer2 Lib is not usable with other interrupts?

Sorry, I haven't worked much with servos. Hopefully, someone else can.