Controlling two DC motors with encoders

Hi to all.

For a project I'm doing I need to extract odometry information from the DC motors.

I'm using two of these Pololu - 131:1 Metal Gearmotor 37Dx73L mm 12V with 64 CPR Encoder (Spur Pinion)
An arduino mega 2560 as the microcontroller
And the motor driver is Pololu Dual VNH5019 Motor Driver Shield for Arduino

I've already assembled the driver shield to arduino mega, and the structure of my robot platform is completed. I've tested performance of each wheel in order to move the wheeled robot and it works fine, but only connecting it directly to power supply (lipo battery ~14-16[V]).

The thing is, idk what's the wire connection to get odom info and the code for reading it. I'm quite new about arduino and I've worked with this only once. I'll appreciate a bit of guidance about the code.

I know that is related to 2-3 and 16-20 interrupts for arduino mega microcontroller, and I think the wire connection once assembled the shields would be.

M1

red wire -->M1A
black wire -->M1B
green wire -->Power supply directly (black wire http://scriptasylum.com/rc_speed/lipo.html, balance wires 4s1p)
blue wire -->Power supply directly (red wire http://scriptasylum.com/rc_speed/lipo.html, balance wires 4s1p)
yellow wire -->interrupt 0
white wire -->interrupt 1

M2 (powered by the same balancer wire)

red wire -->M2A
black wire -->M2B
green wire -->Power supply directly (black wire http://scriptasylum.com/rc_speed/lipo.html, balance wires 4s1p)
blue wire -->Power supply directly (red wire http://scriptasylum.com/rc_speed/lipo.html, balance wires 4s1p)
yellow wire -->interrupt 5
white wire -->interrupt 4

In relation to VIN and GND (between M1 and M2 into the motor driver), there I power the motors, so I don't need powering green and blue wires?

gersonel:
or the encoders Vcc blue wires also power the motors?.

NO. The power for the motors comes through the wires connected to M1A and M1B etc. The power for the encoder is separate. The encoder should work even if the motor is unpowered and the shaft is turned by hand.

...R

Robin2:
NO. The power for the motors comes through the wires connected to M1A and M1B etc. The power for the encoder is separate. The encoder should work even if the motor is unpowered and the shaft is turned by hand.

...R

Thanks robin2, so... red and black wires from M1 and M2 are connected to power supply directly and isn't necessary connect green and blue wires in both motors because encoders works too. Then yellow and white wires are ok, right?

Which is the best site to take codes and learning in order to learn?