I have 3 actuators that I am trying to move in different orders or time with every time my motion sensor is high. basically if some walks in from of the motion sensor the actuators all extend but the second time the walk in front the actuators extend in a different order. the third time the actuators are delayed to close separately and so one. i am figuring 5 different steps then return to the beginning but i can not get the code write. i do not know how to make the actuators stop and wait for the next input high before moving to the next step. the actuators just want to run through the series then wait for the input high. attached is my code.
int motion_1 = 2;
int act_1 = 10;
int act_2 = 11;
int act_3 = 12;
void setup(){
pinMode (motion_1,INPUT);
}
void loop (){
analogWrite (act_1,0);
analogWrite (act_2,0);
analogWrite (act_3,0);
delay(1000);
int sensor_1 = digitalRead(motion_1);
if (sensor_1 == HIGH)
{ analogWrite(act_1,255);
analogWrite(act_2,255);
analogWrite(act_3,255);
delay(8000);
analogWrite(act_1,0);
analogWrite(act_2,0);
analogWrite(act_3,0);}
delay (5000);
if (sensor_1 == HIGH) // i want it to look for a High again before moving to the sencond part
{ analogWrite(act_1,255);
delay(2500);
analogWrite(act_2,255);
delay(2500);
analogWrite(act_3,255);
delay(3000);
analogWrite(act_1,0);
analogWrite(act_2,0);
analogWrite(act_3,0);}
}