2 dc motors and 2 Infrared sensors

Hey guys i need your help. I'm new to this and trying to make a 2 dc motors spin induividually , with two infrared sensors on the arduino board. So one sensor would make the motor spin and the other do the same. I'm very new to this so if there is a code or simple step by step instructions would be amazing. Thanks.

Split your problem into two parts...

a) Write a program for two LEDs, two photosensors. LED "A" should go on when photosensor "A" is illuminated, LED "B" when sensor "B" illuminated.

b) Write a program for two push-buttons. Motor A goes on when button A is down, B goes on when B down.

Once you have each of those working, combining the results will be easy.

Trying to get sensing the sensor and moving the motor working all at once will be a pain.

And before you connect the motors to your Arduino, see....


They probably need the diode.