CODE
--------------------
//AKSHIT INNOVATION 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");
}
}
--------------------------------------------------------------------------
Comments