I'm building a bluetooth controlled robot using these components:
- Arduino Leonardo
- VNH5019 driver shield (http://www.pololu.com/product/2507)
- 2 DC motors with encoders (http://www.pololu.com/product/2273)
- BlueSMiRF bluetooth module (https://www.sparkfun.com/products/12577)
So far I've managed to get the motors running and control the robot with my phone but I can't get the encoders to work.
The shield takes up most of the Leonardo ports. I'm using ports 0-1 (RX-TX) for the bluetooth module and A2-A5 for the encoders. Each hall-effect quadrature encoder has 4 cables: 2 for power and 2 for outputs A and B. I was able to read the encoders using interrupts when I was using the Arduino MEGA but it's not working with the Leonardo.
Can anyone recommend which code to use to read the encoders?
SOLUTION: Rerouting pin 2 to pin 11 on the shield does the trick of freeing enough interrupt pins (2 and 3 / int.1 and int.0) to read the encoders reliably