int sensorThres = 400;
void setup()
{
Serial.begin(9600);
pinMode(10,OUTPUT);
pinMode(13,OUTPUT);
}
void loop()
{
int sensorVoltage;
int sensorValue;
sensorValue = analogRead(A0);
int sensorValue1 = analogRead(A1);
int analogSensor = analogRead(A2);
sensorVoltage = sensorValue/1024*5.0;
Serial.println("LPG gas level checking");
Serial.print("LPG gas level = ");
Serial.println(sensorValue);
Serial.println("smoke senor level checking ");
Serial.print("smoke senor level = ");
Serial.println(sensorValue1);
Serial.println("co gas sensor level checking ");
Serial.print("co gas sensor level = ");
Serial.println(analogSensor);
if(sensorValue > 30)
{
digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level)
delay(100); // wait for a second
digitalWrite(13, LOW); // turn the LED off by making the voltage LOW
delay(100);
tone(buzzer, 1000, 200);
}
else if(sensorValue1 > 30)
{
digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level)
delay(100); // wait for a second
digitalWrite(13, LOW); // turn the LED off by making the voltage LOW
delay(100);
tone(buzzer, 1000, 200);
}
else if(analogSensor > 300)
{
digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level)
delay(100); // wait for a second
digitalWrite(13, LOW); // turn the LED off by making the voltage LOW
delay(100);
tone(buzzer, 1000, 200);
}
else
{
digitalWrite(13, LOW); // turn the LED on (HIGH is the voltage level)
noTone(buzzer);
}
delay(3000);
}