31 lines
583 B
C++
31 lines
583 B
C++
#include <ctrlLed.h>
|
|
#include <FireBaseHandler.h>
|
|
#include <ctrlSpeaker.h>
|
|
#include <ctrlRfid.h>
|
|
#include <branchements.h>
|
|
|
|
volatile bool motionDetected = false;
|
|
|
|
void IRAM_ATTR onMotionDetected() {
|
|
motionDetected = true; // Flag à traiter dans loop()
|
|
}
|
|
|
|
void setup() {
|
|
pinMode(A2, INPUT);
|
|
pinMode(D2, OUTPUT);
|
|
attachInterrupt(digitalPinToInterrupt(A2), onMotionDetected, RISING);
|
|
|
|
blinkSlowGreen();
|
|
}
|
|
|
|
void loop() {
|
|
if(motionDetected){
|
|
Serial.println("Mouvement détecté !");
|
|
blinkFastRed();
|
|
startSirene();
|
|
}
|
|
updateLed();
|
|
updateSirene();
|
|
}
|
|
|