Just set the strobe relay pin low.
this project using as prototype sir, to prove the system is working
should i set LOW for the strobe relay in setup or in the loop?
In loop. Presumably you'll eventually have it inside an if that checks the alarm.
Fully understand this.
Your relay module needs (probably) a LOW on the input pin to turn on the siren or strobe.
digitalWrite(relayStrobe, LOW); // This turns ON the siren
And
digitalWrite(relayStrobe, HIGH); // This turns OFF the siren
Suggested that you turn on/off the siren just to prove that it was wired properly.
i try this, declare a new if statement to check the strobe relay state
unsigned long previousMillis = 0;
int relayState = LOW;
int relayState2 = LOW;
const long interval = 3000;
const int relayStrobe = 6;
const int relaySiren = 7;
void setup() {
pinMode(relayStrobe, OUTPUT);
pinMode(relaySiren, OUTPUT);
}
void loop() {
if (relayState2 == LOW){
relayState2=!relayState2;
digitalWrite(relayStrobe,relayState2);
}
unsigned long currentMillis = millis();
if (currentMillis - previousMillis >= interval){
previousMillis = currentMillis;
relayState=!relayState;
digitalWrite(relaySiren,relayState);
}
}
still nothing happen with the strobe relay
Just set it low.
i get it sir, i have set the strobe relay HIGH at the global variable and add if statement on loop. its working now.
thank you sir
unsigned long previousMillis = 0;
int relayState = LOW;
int relayState2 = HIGH;
const long interval = 3000;
const int relayStrobe = 6;
const int relaySiren = 7;
void setup() {
pinMode(relayStrobe, OUTPUT);
pinMode(relaySiren, OUTPUT);
}
void loop() {
if (relayState2 == HIGH){
relayState2=!relayState2;
digitalWrite(relayStrobe,relayState2);
}
unsigned long currentMillis = millis();
if (currentMillis - previousMillis >= interval){
previousMillis = currentMillis;
relayState=!relayState;
digitalWrite(relaySiren,relayState);
}
}
yes sir, i have done it. and it is working.
thankyou
At the speed that loop( ) runs, you need a TIMER/delay.
However, in the above code section, since initial setting for relayState2 is LOW.
int relayState2 = LOW;
Therefore the monument you run the sketch, you make it HIGH.
Please, as we have said/urged you, to turn ON the strobe you need to send a LOW to the relay module.
Actually high, which is why the thing is working now.
yes sir, my bad. i am a little bit confusing of using HIGH and LOW for relay.
now that is done. thank you for helping me
I stand corrected, damn iPad screen (got to blame something)
yes, everything is working now. thank you sir
of course, the ipad should be blame
Just to confirm, things are working as you want now ?
And, we have proven your relay module requires a LOW on its inputs to energize that relay.
YES SIR
everything is working now, just the way it is.
Right now at power up, it appears that the siren runs periodically and the strobe is always on. Is this the desired behavior? I was expecting that there would be an alarm input that would trigger siren & strobe.
Is power up itself an indication that the alarm has been triggered?
yes, that is working as i wanted now.
for the trigger will be more advance and some bigger problem that i have to figure out sir . this system later, will working with VL53L1X as water level sensor, LoRa as communication module, integrated with Website to display the real-time sensor data and more database level of processing to set the alarm.
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.