top of page
Search
Writer's pictureAKSHIT'S INNOVATION LAB

Code & Circuit Diagram for Fire Alarm

CIRCUIT DIAGRAM



CODE

//AKSHITINNOVATION LAB

#include<SoftwareSerial.h>

int flameSensor = 2;

int buzzer = 12;


void setup()

{

pinMode (2,INPUT);

pinMode (12,OUTPUT);

Serial.begin(9600);


}


void loop()

{

int sensorValue = digitalRead(2);

Serial.print("fire status:");

if(sensorValue == 1)

{

digitalWrite(12,HIGH);// buzzing if fire detected

Serial.print("fire detected\n");

}


else

{

digitalWrite(12,LOW);//stop buzzing if no fire detected

Serial.print("no fire detected\n");

}

}

--------------------------------------------------------------

34 views0 comments

Recent Posts

See All

Opmerkingen


bottom of page