driving 2 12v 2A DC motors with Mega

So the sensor can be found at this link. And if I understand correctly I attach that separately to the Arduino and use the Arduino to read the optical sensor and then based on the reading of the sensor the Arduino talks to the motor?