Hello everyone, I'm doing a motion sensor alarm project. I wanted to do arming via a button. If you press the button, it should start a timer for 30 seconds. After the timer, it should Serial.println("timer stop");
and start the motion sensor. If you do not press the button after turning on the power or the timer does not end after pressing the button, then the motion sensor should not react.
int pirPin = D7;
void setup() {
Serial.begin(9600);
pinMode(pirPin, INPUT);
pinMode(D3, INPUT_PULLUP);
}
void loop() {
if (digitalRead(pirPin) == HIGH)
{
Serial.println("MOVEMENT");
}
else
{
Serial.println("Too soon");
}
}