timed motor running. PAID GIG!!!

Hi guys. I am brand new to coding and arduino in general. I have been trying to learn this but it seems it is a but to advanced for me to understand at this point in time. A project of mine will need a dc motor to run for "x"amount of time that is set in code, then shut one motor off and run a second DC motor for a different "x" amount of time pre-set in code then reverting back to initial motor again.
I was thinking about using "millis()" to control this but just havent been able to succeed. I am willing to pay someone to write a code that would make me be able to achieve this or even supply me witha code that is easy to adapt.
components i currently have are Arduino uno, a sensor shield, 2 dc motors and 2 mosfet for the switching, i will be utilizing an external 12V power supple as well.
I would love to take time and learn all this but my deadline is unfortunaely quickly approaching.

any and all help would be much appreciated.

Hi Bullet,

How precisely do you need to control the motors? Can you describe the setup a little better?

Have you considered using limit switches instead of running them for "x" milliseconds?

Do you need to reverse you motors? If so, 2 mosfets is not enouth. Use bridge schematic (or 2 relays + mosfet).

As about code:
You may use delay or millis function

For example:

loop(){
digitalWrite(13, HIGH);
delay(1000);
digitalWrite(13, LOW);

digitalWrite(12, HIGH);
delay(1000);
digitalWrite(12, LOW);

delay(1000);
}

or

loop(){
unsigned long int time; // time, ms

time = 1000;

if (millis() >= time){
 digitalWrite(13, HIGH);

}

time = 2000;

if (millis() >= time){
 digitalWrite(13, LOW);

}

time = 3000;

if (millis() >= time){
 digitalWrite(12, HIGH);

}

time = 4000;

if (millis() >= time){
 digitalWrite(12, LOW);

}

}

A project of mine will need a dc motor to run for "x"amount of time that is set in code, then shut one motor off and run a second DC motor for a different "x" amount of time pre-set in code then reverting back to initial motor again.

No problem. This sketch runs motor a, then runs motor b, then "goes back to motor A". You can test this by putting a couple of LEDs on pins 4 and 5.

// motors are on pins 4 and 5

const byte motorA = 4;
const byte motorB = 5;

void setup() {
  pinMode(motorA, OUTPUT);
  pinMode(motorB, OUTPUT);
  digitalWrite(motorA, HIGH);
  delay(500); // half a second
  digitalWrite(motorA, LOW);

  digitalWrite(motorB, HIGH);
  delay(2000); // two seconds
  digitalWrite(motorB, LOW);
 
  // go back to motor A
  digitalWrite(motorA, HIGH);
}

void loop() {}

But maybe that's not what you want. Maybe what you want is for the sketch to continuously cycle between A and B.

// motors are on pins 4 and 5

const byte motorA = 4;
const byte motorB = 5;

void setup() {
  pinMode(motorA, OUTPUT);
  pinMode(motorB, OUTPUT);
}

loop() {
  digitalWrite(motorA, HIGH);
  delay(500); // half a second
  digitalWrite(motorA, LOW);

  digitalWrite(motorB, HIGH);
  delay(2000); // two seconds
  digitalWrite(motorB, LOW);
}

This will do also what you have asked. But I'm betting that there are requirements that you haven't mentioned.

Another way to do this, incidentally, would be to wire up a multivibrator with resistors and capacitors. A circuit like that would possibly be able to drive your motors directly.