|
@ -12,6 +12,7 @@ |
|
|
#define LED8 8
|
|
|
#define LED8 8
|
|
|
|
|
|
|
|
|
#define Sensor A6
|
|
|
#define Sensor A6
|
|
|
|
|
|
#define SPKR 5
|
|
|
|
|
|
|
|
|
uint16_t gasVAL; |
|
|
uint16_t gasVAL; |
|
|
|
|
|
|
|
@ -28,6 +29,7 @@ pinMode(LED6, OUTPUT); |
|
|
pinMode(LED7, OUTPUT); |
|
|
pinMode(LED7, OUTPUT); |
|
|
pinMode(LED8, OUTPUT); |
|
|
pinMode(LED8, OUTPUT); |
|
|
|
|
|
|
|
|
|
|
|
pinMode(SPKR, OUTPUT); |
|
|
|
|
|
|
|
|
Startup(); |
|
|
Startup(); |
|
|
|
|
|
|
|
@ -45,12 +47,27 @@ delay(30); |
|
|
|
|
|
|
|
|
void Startup (void){ |
|
|
void Startup (void){ |
|
|
|
|
|
|
|
|
|
|
|
Serial.println("Flammable Gas Sensor"); |
|
|
|
|
|
Serial.println("Begin"); |
|
|
|
|
|
|
|
|
|
|
|
int yy = 0; |
|
|
|
|
|
for(yy=200;yy<1200;yy+=150){ |
|
|
|
|
|
tone(SPKR,yy,100); |
|
|
|
|
|
delay(100); |
|
|
|
|
|
} |
|
|
|
|
|
/*
|
|
|
|
|
|
for(yy=2000;yy>100;yy-=100){ |
|
|
|
|
|
tone(SPKR,yy,100); |
|
|
|
|
|
delay(50); |
|
|
|
|
|
}*/ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
digitalWrite(LED1,HIGH); |
|
|
digitalWrite(LED1,HIGH); |
|
|
digitalWrite(LED2,HIGH); |
|
|
digitalWrite(LED2,HIGH); |
|
|
digitalWrite(LED3,HIGH); |
|
|
digitalWrite(LED3,HIGH); |
|
|
digitalWrite(LED4,HIGH); |
|
|
digitalWrite(LED4,HIGH); |
|
|
|
|
|
|
|
|
delay(1000); |
|
|
|
|
|
|
|
|
delay(500); |
|
|
digitalWrite(LED1,LOW); |
|
|
digitalWrite(LED1,LOW); |
|
|
digitalWrite(LED2,LOW); |
|
|
digitalWrite(LED2,LOW); |
|
|
digitalWrite(LED3,LOW); |
|
|
digitalWrite(LED3,LOW); |
|
@ -61,13 +78,14 @@ digitalWrite(LED6,HIGH); |
|
|
digitalWrite(LED7,HIGH); |
|
|
digitalWrite(LED7,HIGH); |
|
|
digitalWrite(LED8,HIGH); |
|
|
digitalWrite(LED8,HIGH); |
|
|
|
|
|
|
|
|
delay(1000); |
|
|
|
|
|
|
|
|
delay(500); |
|
|
digitalWrite(LED5,LOW); |
|
|
digitalWrite(LED5,LOW); |
|
|
digitalWrite(LED6,LOW); |
|
|
digitalWrite(LED6,LOW); |
|
|
digitalWrite(LED7,LOW); |
|
|
digitalWrite(LED7,LOW); |
|
|
digitalWrite(LED8,LOW); |
|
|
digitalWrite(LED8,LOW); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void lightLED( uint16_t reading){ |
|
|
void lightLED( uint16_t reading){ |
|
@ -81,6 +99,7 @@ if (reading >= 750){ |
|
|
digitalWrite(LED6,HIGH); |
|
|
digitalWrite(LED6,HIGH); |
|
|
digitalWrite(LED7,HIGH); |
|
|
digitalWrite(LED7,HIGH); |
|
|
digitalWrite(LED8,HIGH); |
|
|
digitalWrite(LED8,HIGH); |
|
|
|
|
|
tone(SPKR,750,100); |
|
|
} |
|
|
} |
|
|
else if (reading >= 700){ |
|
|
else if (reading >= 700){ |
|
|
digitalWrite(LED1,HIGH); |
|
|
digitalWrite(LED1,HIGH); |
|
@ -91,6 +110,7 @@ else if (reading >= 700){ |
|
|
digitalWrite(LED6,HIGH); |
|
|
digitalWrite(LED6,HIGH); |
|
|
digitalWrite(LED7,HIGH); |
|
|
digitalWrite(LED7,HIGH); |
|
|
digitalWrite(LED8,LOW); |
|
|
digitalWrite(LED8,LOW); |
|
|
|
|
|
tone(SPKR,700,100); |
|
|
} |
|
|
} |
|
|
else if (reading >= 650){ |
|
|
else if (reading >= 650){ |
|
|
digitalWrite(LED1,HIGH); |
|
|
digitalWrite(LED1,HIGH); |
|
@ -101,6 +121,7 @@ else if (reading >= 650){ |
|
|
digitalWrite(LED6,HIGH); |
|
|
digitalWrite(LED6,HIGH); |
|
|
digitalWrite(LED7,LOW); |
|
|
digitalWrite(LED7,LOW); |
|
|
digitalWrite(LED8,LOW); |
|
|
digitalWrite(LED8,LOW); |
|
|
|
|
|
tone(SPKR,650,100); |
|
|
} |
|
|
} |
|
|
else if (reading >= 600){ |
|
|
else if (reading >= 600){ |
|
|
digitalWrite(LED1,HIGH); |
|
|
digitalWrite(LED1,HIGH); |
|
@ -111,6 +132,7 @@ else if (reading >= 600){ |
|
|
digitalWrite(LED6,LOW); |
|
|
digitalWrite(LED6,LOW); |
|
|
digitalWrite(LED7,LOW); |
|
|
digitalWrite(LED7,LOW); |
|
|
digitalWrite(LED8,LOW); |
|
|
digitalWrite(LED8,LOW); |
|
|
|
|
|
tone(SPKR,600,100); |
|
|
} |
|
|
} |
|
|
else if (reading >= 550){ |
|
|
else if (reading >= 550){ |
|
|
digitalWrite(LED1,HIGH); |
|
|
digitalWrite(LED1,HIGH); |
|
@ -121,6 +143,7 @@ else if (reading >= 550){ |
|
|
digitalWrite(LED6,LOW); |
|
|
digitalWrite(LED6,LOW); |
|
|
digitalWrite(LED7,LOW); |
|
|
digitalWrite(LED7,LOW); |
|
|
digitalWrite(LED8,LOW); |
|
|
digitalWrite(LED8,LOW); |
|
|
|
|
|
tone(SPKR,550,100); |
|
|
} |
|
|
} |
|
|
else if (reading >= 500){ |
|
|
else if (reading >= 500){ |
|
|
digitalWrite(LED1,HIGH); |
|
|
digitalWrite(LED1,HIGH); |
|
@ -131,8 +154,9 @@ else if (reading >= 500){ |
|
|
digitalWrite(LED6,LOW); |
|
|
digitalWrite(LED6,LOW); |
|
|
digitalWrite(LED7,LOW); |
|
|
digitalWrite(LED7,LOW); |
|
|
digitalWrite(LED8,LOW); |
|
|
digitalWrite(LED8,LOW); |
|
|
|
|
|
tone(SPKR,500,100); |
|
|
} |
|
|
} |
|
|
else if (reading >= 450){ |
|
|
|
|
|
|
|
|
else if (reading >= 410){ |
|
|
digitalWrite(LED1,HIGH); |
|
|
digitalWrite(LED1,HIGH); |
|
|
digitalWrite(LED2,HIGH); |
|
|
digitalWrite(LED2,HIGH); |
|
|
digitalWrite(LED3,LOW); |
|
|
digitalWrite(LED3,LOW); |
|
@ -141,8 +165,9 @@ else if (reading >= 450){ |
|
|
digitalWrite(LED6,LOW); |
|
|
digitalWrite(LED6,LOW); |
|
|
digitalWrite(LED7,LOW); |
|
|
digitalWrite(LED7,LOW); |
|
|
digitalWrite(LED8,LOW); |
|
|
digitalWrite(LED8,LOW); |
|
|
|
|
|
tone(SPKR,410,100); |
|
|
} |
|
|
} |
|
|
else if (reading >= 400){ |
|
|
|
|
|
|
|
|
else if (reading >= 300){ |
|
|
digitalWrite(LED1,HIGH); |
|
|
digitalWrite(LED1,HIGH); |
|
|
digitalWrite(LED2,LOW); |
|
|
digitalWrite(LED2,LOW); |
|
|
digitalWrite(LED3,LOW); |
|
|
digitalWrite(LED3,LOW); |
|
@ -152,7 +177,17 @@ else if (reading >= 400){ |
|
|
digitalWrite(LED7,LOW); |
|
|
digitalWrite(LED7,LOW); |
|
|
digitalWrite(LED8,LOW); |
|
|
digitalWrite(LED8,LOW); |
|
|
} |
|
|
} |
|
|
else { |
|
|
|
|
|
|
|
|
else if (reading >= 0){ |
|
|
|
|
|
digitalWrite(LED1,LOW); |
|
|
|
|
|
digitalWrite(LED2,LOW); |
|
|
|
|
|
digitalWrite(LED3,LOW); |
|
|
|
|
|
digitalWrite(LED4,LOW); |
|
|
|
|
|
digitalWrite(LED5,LOW); |
|
|
|
|
|
digitalWrite(LED6,LOW); |
|
|
|
|
|
digitalWrite(LED7,LOW); |
|
|
|
|
|
digitalWrite(LED8,LOW); |
|
|
|
|
|
} |
|
|
|
|
|
/*else {
|
|
|
digitalWrite(LED1,HIGH); |
|
|
digitalWrite(LED1,HIGH); |
|
|
digitalWrite(LED2,LOW); |
|
|
digitalWrite(LED2,LOW); |
|
|
digitalWrite(LED3,HIGH); |
|
|
digitalWrite(LED3,HIGH); |
|
@ -161,7 +196,7 @@ else { |
|
|
digitalWrite(LED6,LOW); |
|
|
digitalWrite(LED6,LOW); |
|
|
digitalWrite(LED7,HIGH); |
|
|
digitalWrite(LED7,HIGH); |
|
|
digitalWrite(LED8,LOW); |
|
|
digitalWrite(LED8,LOW); |
|
|
} |
|
|
|
|
|
|
|
|
}*/ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|