@s355 (S355) posted a new topic, subject "Make an arduino fire alarm". It read:

   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?

After which, @UKHeliBob (UKHeliBob) added

    What is a Code-3 pattern ?
    
    Can you read the flame sensor ?  
    If so, then please post your code and details of the sensor

To which @s355 (S355) replied

    [code]
        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
        }
        
    [/code]
    
    Sensor: Adafruit flame sensor  
    The Code-3 pattern is the sound a smoke alarm makes when it goes off.

Then @UKHeliBob (UKHeliBob) said

    Sorry, but I have no idea what a US fire alarm sounds like. Which device are you going to use to make the sound ?

After which, @s355 (S355) added

    Code 3 sounds like this.  
    I am using a buzzer.

So @system (system) replied

    This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.


{'source': 'discourse', 'url': 'https://forum.arduino.cc/t/make-an-arduino-fire-alarm/873237', 'title': 'Make an arduino fire alarm', 'views': 179, 'has_accepted_answer': False, 'word_count': 293, 'like_count': 0, 'reply_count': 1, 'participant_count': 2, 'posts': 6, 'tags': '', 'author': '@s355 (S355)', 'participants': '@s355 (S355), @UKHeliBob (UKHeliBob), @system (system)', 'image_url': [None], 'created_at': '2021-06-10T21:04:11.272Z', 'last_posted_at': '2021-10-08T21:49:50.114Z'}