someone help me please

I have to design a dc motor that when I press a button the engine rotates to one side for a certain time and then stops, after that if I press the button again the engine rotates to the other side for the same amount of time and I don’t know how to do the programming
Help me please

Motor control is an advanced topic and requires some knowledge of electronics, a motor, a suitable motor driver and a motor power supply. However, you can demonstrate the basic ideas of motor control with just a red and green LED plus two required resistors (green LED = turning forward, red LED = backward).

We recommend to start with the basics. Get an Arduino and work your way through the tutorials that come with it, or are available on line.

Learn to control an LED, read a switch, a voltage or a sensor, learn the programming language and the special features of an Arduino. Otherwise, expect endless frustration.

Perhaps you should tell us exactly what components you have to do all this with. What Arduino, motor, motor driver etc. Then tell us what programming experience and abilities you do have.

Steve

Driving a motor for a fixed time is not advanced in any way, its just setting a digital pin high for a
particular time.

This doesn't sound like motion control (when the angle turned would be the parameter of interest,
not the time the motor runs for).

Any basic DC motor example should apply here.

As mentioned, we need to see what components you have.

For simple motor control using discrete components see image below.

You can use relays, MOSFETs and motor drivers to change motor direction.

Using a motor driver from Pololu is a great all in one solution.