Question about baby orangutan and wheel encoders


I’m reading the documentation about wheel encoders ( ) and It says: it uses the AVR’s PCINT0, PCINT1, and PCINT2

Looking for the AVR328 datasheet ( … oc8025.pdf ) these interrupts belongs to PB0, PB1 y PB2 pins.

However in baby orangutan PB1 and PB2 pins are assigned to Timer1 PWM outputs (A and B) ( ), so if they are pre-assigned as outputs I can’t use them for wheel encoder inputs, is it so?

May I change the Pololu Library to use another PCINTs?

Thank you.



There is no need to change the Pololu AVR Library, since it was specifically designed to work with our Orangutan controllers. The Command Reference that you linked to explains that the arguments to encoders_init() determine the pins that will be used - they can be selected from any of the Baby Orangutan’s digital I/O lines. Can you quote the part of the datasheet that suggests otherwise to you?



Note that our documentation says “It uses the PCINT0, PCINT1, and PCINT2 interrupts”, which are not the same as the PCINT0 (PB0), PCINT1 (PB1), and PCINT2 (PB2) pins. I think this the source of your confusion.

Each PCINTx interrupt can be triggered by up to eight digital I/O pins (a special mask register for each PCINTx interrupt determines which pins trigger the ISR). For example, the PCINT0 interrupt can be triggered by pins PCINT0 - PCINT7 (PB0 - PB7), as determined by the bits of the PCMSK0 register. Together, the three PCINTx interrupts allow you to use any digital input on the board to trigger a pin-change interrupt. Does this make sense?

- Ben

Thank you Paul and Ben.

I was wrong with interrupts and pins and I thought they have an unique correspondence.