1int led_pin=A0;
2int Buzzer=A4;
3int analog_pin=A1;
4void setup() {
5 Serial.begin(9600);
6 pinMode(led_pin, OUTPUT);
7 pinMode(Buzzer, OUTPUT);
8}
9
10void loop() {
11 int Val;
12 Val=analogRead(analog_pin);
13 Serial.println(Val);
14 if(Val<130)
15 {
16 Serial.println("Flame Detection!!");
17 digitalWrite(led_pin,HIGH);
18 digitalWrite(Buzzer,HIGH);
19 delay(1000);
20 digitalWrite(led_pin,LOW);
21 digitalWrite(Buzzer,LOW);
22 delay(1000);
23 }
24 else
25 {
26 Serial.println("No dangerous!");
27 digitalWrite(led_pin,LOW);
28 digitalWrite(Buzzer,LOW);
29 delay(500);
30 }
31 }
32