driving 2 12v 2A DC motors with Mega

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?

That is right.

Have you connected the sensor and can you read it?