Motor DC + Ponte H L293D

Good afternoon, I’m started on Arduino recently acquired an Arduino UNO, two DC motors and a 12v H bridge (L293D Dual H Bridge Motor Driver).

With only an ON and OFF I intended to accomplish the following functions:

When the switch is ON the motor should run for 10 seconds and then stop, then turn on an LED.

If the button should be OFF the LED off and the engine to run 10 seconds in the opposite direction and then stop.

I’ve tried some examples but still could not get a code that works correctly, asking for your help to solve this my little problem.

I don’t use Arduino but many other processors so can help on a basic level.

Start with just LEDs (with correct limiting resistors) on the Arduino output pins to debug the code.

Use switches and resistors (resistor pull-up, switch to ground) on the L293 digital inputs to test its motor control functions.

This divides the possible problems and is easier to trouble shoot.

Once both parts work correctly then connect the Arduino to the L293.

Also, don’t forget to connect the ground common between the Arduino and the L293.