I have got the flame sensor and the monitoring, but if a fire is detected, how do I make it sound in a Code-3 pattern (as in a real fire alarm system or a smoke alarm) and flash the LED very shortly every second?
What is a Code-3 pattern ?
Can you read the flame sensor ?
If so, then please post your code and details of the sensor
int relay = 4 ;// define relay pin
int flamedigital = 9; // define the flame sensor digital pin
int flameanalog = A3; // define the flame sensor analog pin
int buzzer = 11; //define buzzer pin
int val ; // define numeric variable val
float sensor; //define floating variable sensor
void setup ()
{
pinMode (flamedigital, INPUT) ;// input interface defines the flame sensor
pinMode (flameanalog, INPUT) ;// input interface defines the flame sensor
pinMode (relay, OUTPUT); //output interface defines the relay
pinMode (buzzer, OUTPUT); //output interface defines the buzzer
}
void loop ()
{
sensor = analogRead(flameanalog); //read flameanalog value and assigne it to sensor variable
val = digitalRead (flamedigital) ;// read flamedigital value and assigne it to val variable
if (val == HIGH) // When the flame sensor detects a signal relay is on and buzzer sound (void alarm)
{
alarm();
digitalWrite (relay, HIGH); //close the relay circuit
}
else
{
digitalWrite (relay, LOW); //open the relay circuit
}
delay(1000);
}
void alarm() {
//code 3 buzzer pattern
}
Sensor: Adafruit flame sensor
The Code-3 pattern is the sound a smoke alarm makes when it goes off.
Sorry, but I have no idea what a US fire alarm sounds like. Which device are you going to use to make the sound ?
This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.