Magnetic encoder with zumo arduino

Hi im here to ask for help, i have a leonardo which ive read you need for the 4 interrupts 0,1,2,3 and 7. other than that i have no idea!
any help on setting this up would be appreciated. im using the 1.2v zumo (shouldn’t make a difference).


The Zumo Robots for Arduino do not have encoders like the newer Zumo 2040 and Zumo 32U4 robots.


i put the magnetic encoders on the metal gear motors myself.

A good first step is probably to figure out which pins you’re going to use to read the encoder signals. For best results, I recommend using ones with interrupts if possible. On the Arduino Leonardo, the pins you listed have external interrupts, and in addition to that pins 8, 9, 10, 11, 14 (MISO), 15 (SCK), 16 (MOSI) have pin-change interrupts. Alternatively, you could consider switching to an Arduino Uno, since all of the pins on the Arduino Uno have pin-change interrupts.

Either way, you can reference the “Arduino pin assignment table” section of the Zumo for Arduino user’s guide to see which pins the Zumo peripherals are already using and which ones are free (or can be freed up by not using it’s optional purpose). Additionally, please note that if you are using the Zumo Reflectance array, the line sensors use pins 5, A2, A0, 11, A3, and 4 by default. You can find more information about that in the “Adding a Zumo reflectance sensor array (optional)” section of the guide.