int motoA = 2; // motor sentido 1
int motoB = 3; // motor sentido 2
int releA = 4; // rele 2
int releB = 5; // rele 3
int releC = 6; // rele 4
int onTime1 = 3 * 500;
int onTime2 = 1 * 500;
int onTime3 = 2 * 500;
void setup() {
pinMode(motoA, OUTPUT);
pinMode(motoB, OUTPUT);
pinMode(releA, OUTPUT);
pinMode(releB, OUTPUT);
pinMode(releC, OUTPUT);
}
void loop() {
if (digitalRead(releC) == LOW) {
digitalWrite(motoA, HIGH);
delay (onTime1);
digitalWrite(motoA, LOW);
}
if (digitalRead(releC) == LOW) {
digitalWrite(motoB, HIGH);
delay (onTime1);
digitalWrite(motoB, LOW);
}
if (digitalRead(releC) == LOW) {
digitalWrite(releA, HIGH);
delay (onTime2);
digitalWrite(releA, LOW);
}
if (digitalRead(releA) == LOW) {
digitalWrite(releB, HIGH);
delay (onTime2);
digitalWrite(releB, LOW);
}
if (digitalRead(releB) == LOW) {
digitalWrite(releC, HIGH);
delay (onTime3);
digitalWrite(releC, LOW);
}
}