Controlling two motors with time relays

Hello guys,

Im pretty new in this world of programming with Arduino… I have basic UNO R3 controller.
I know basics of programming.

My first project is turning ON M1 & M2 with pushbutton,and turning them of with C.T.

What i am trying to do will be described in few steps.

  1. When PUSHBUTTON is pressed, MOTOR 1 start. After delay of 4 seconds MOTOR 2 start.
  2. These two (M1 & M2) works until C.T.(current transformer) turns on.
  3. When C.T. is on, M2 goes off,after delay of 8 seconds M1 goes off.

test every 5 minutes

M1 goes ON then M2 goes ON.
They go OFF when C.T. is ON.

const int kPinButton1 = 2;  // pushbutton
const int kPinMotor1 = 9;  // M1
const int kPinMotor2 = 10;  //M2
const int kPinCT = 11; // Current transf.


void setup() {
  Serial.begin(9600);
  pinMode(kPinButton1, INPUT);
  digitalWrite(kPinButton1, HIGH);

  pinMode(9, OUTPUT); //M1
  pinMode(10, OUTPUT); //M2
  pinMode(11, OUTPUT); // C.T.


}

void loop() {
  if (digitalRead(kPinButton1) == HIGH) {
    digitalWrite(9, HIGH);
    delay(4000);
    digitalWrite(10, HIGH);

    if (digitalRead(11) == HIGH) {
      digitalWrite(10, LOW);
      delay(8000);
      digitalWrite(9, LOW);
    }


  }
}

Is this true or false? Thanks
Kevin

KevinGeez:
Hello guys,

Im pretty new in this world of programming with Arduino... I have basic UNO R3 controller.
I know basics of programming.

My first project is turning ON M1 & M2 with pushbutton,and turning them of with C.T.

What i am trying to do will be described in few steps.

  1. When PUSHBUTTON is pressed, MOTOR 1 start. After delay of 4 seconds MOTOR 2 start.
  2. These two (M1 & M2) works until C.T.(current transformer) turns on.
  3. When C.T. is on, M2 goes off,after delay of 8 seconds M1 goes off.

test every 5 minutes

M1 goes ON then M2 goes ON.
They go OFF when C.T. is ON.

const int kPinButton1 = 2;  // pushbutton

const int kPinMotor1 = 9;  // M1
const int kPinMotor2 = 10;  //M2
const int kPinCT = 11; // Current transf.

void setup() {
  Serial.begin(9600);
  pinMode(kPinButton1, INPUT);
  digitalWrite(kPinButton1, HIGH);

pinMode(9, OUTPUT); //M1
  pinMode(10, OUTPUT); //M2
  pinMode(11, OUTPUT); // C.T.

}

void loop() {
  if (digitalRead(kPinButton1) == HIGH) {
    digitalWrite(9, HIGH);
    delay(4000);
    digitalWrite(10, HIGH);

if (digitalRead(11) == HIGH) {
      digitalWrite(10, LOW);
      delay(8000);
      digitalWrite(9, LOW);
    }

}
}





Is this true or false? Thanks 
Kevin

Who knows? What do you get when you try it? Replace motors with LEDs for a visual indication.

What CT are you using? Is the motor power AC or DC? What motors? Do they need a controller or controllers?

Paul

You are turning on a CT? But they are just transformers, they output an AC signal, so that makes no sense.

You should be posting full details of the hardware you are talking about, that answers many questions
that otherwise we have to ask, like "which CT", "which motor?", "which motor controller/driver?", etc etc.