What can I do, to make condition 2 to restart including the time "delay (10000);" , every time Sensor PIR detects movement (true) ? Please help
int led = 13;
int pin = 3;
int value = 0;
int pinState = LOW;
void setup() {
pinMode(led, OUTPUT);
pinMode(pin, INPUT);
Serial.begin(9600);
}
void loop() { //(Condition 1)
value = digitalRead(pin);
if (value == true) {
pinState = true;
digitalWrite(led, HIGH);
Serial.println("Motion Detected!");
delay(1000);
}//Condition 2
value = digitalRead(pin);
while(pinState == true) {
Serial.println("Motion Still Detected!");
delay(10000);
//here is the problem
//What can I do, to make condition 2 to restart including the time "delay (10000);" , every time Sensor PIR detects movement? Please help
}
}
}
if (pinState == HIGH) {
pinState = false;
Serial.println("Motion ended");
digitalWrite(led, LOW);
}