I would like to control 2 motors with the Arduino Uno board, which provides only two interrupt pins on digital 2 and 3.
I've set one encoder using these pins, and it works. What do you think about the following approaches:
- Timer Interrupt:
Create a Timer Interrupt. Connect the seconder encoder to an analog pin. Set an analog read function in the interrupt service routine. Change the prescaler of the ADC and increase the acquisition time.
Use PinChangeInt to capture the pin change interrupt rather than an external interrupt.
This should allow you to use almost any I/O pins on the Uno for the encoder.
as Ignacio Vazquez-Abrams suggested here