driving 2 12v 2A DC motors with Mega

I think that the sensor is wired like this:

OPTO SENSOR.jpg

Google "Optical Infrared Water Liquid Level Sensor " and this is a common 4 wire diagram.