How Activate a motor for a fixed amount of time?

How can I order my stepper motor vehicle 5 seconds clockwise and anti-clockwise 5 seconds go round?

int motorPin1 = 8; // Blue - 28BYJ48 pin 1
int motorPin2 = 9; // Pink - 28BYJ48 pin 2
int motorPin3 = 10; // Yellow - 28BYJ48 pin 3
int motorPin4 = 11; // Orange - 28BYJ48 pin 4
// Red - 28BYJ48 pin 5 (VCC)

int motorSpeed = 0; //variable to set stepper speed
int sensorValue = 0; //potentiometer connected to A0
long int currentMillis;

//////////////////////////////////////////////////////////////////////////////
void setup() {
//declare the motor pins as outputs
pinMode(motorPin1, OUTPUT);
pinMode(motorPin2, OUTPUT);
pinMode(motorPin3, OUTPUT);
pinMode(motorPin4, OUTPUT);
Serial.begin(9600);
}

//////////////////////////////////////////////////////////////////////////////
void loop(){

sensorValue = analogRead(A0); // read the value of the potentiometer
Serial.println(sensorValue); // View full range from 0 - 1024 in Serial Monitor
if (sensorValue < 535){ // if potentiometer reads 0 to 535 do this
motorSpeed = (1); //scale potValue to be useful for motor

clockwise(); //go to the ccw rotation function
delay(0);

}
else { //value of the potentiometer is 512 - 1024
motorSpeed = (1); //scale potValue for motor speed
counterclockwise(); //go the the cw rotation function
delay(0);
}
}

The demo Several Things at a Time illustrates the use of millis() to manage timing. Don’t use delay().

Save the value of millis() before the first step and then keep stepping the motor until 5000 millisec has elapsed.

…R
Stepper Motor Basics
Simple Stepper Code

I can not do programming please help. I'm field is architecture

I can not do programming please help.

You have a good start, because Arduinos are for learning to program! Work your way through the simple examples that are provided, such as Blink without Delay, and your task will become trivial.

amin_jafarvand: I can not do programming please help. I'm field is architecture

If you want someone else to write the program for you please ask in the Gigs and Collaborations section - and be prepared to pay.

The other areas of the Forum are for people who want help with their own programs.

...R