MQ7 gas sensor

parent f8263ef9
//Detect Carbon Monoxide
void setup() {
pinMode(A0, INPUT);
pinMode(13, OUTPUT);
pinMode(12, OUTPUT);
Serial.begin(9600);
}
void loop() {
int sens = analogRead(A0);
if(sens >= 220){
digitalWrite(13, HIGH);
delay(500);
digitalWrite(13, LOW);
digitalWrite(12, HIGH);
delay(500);
digitalWrite(12, LOW);
digitalWrite(13, HIGH);
delay(500);
digitalWrite(13, LOW);
digitalWrite(12, HIGH);
delay(500);
digitalWrite(12, LOW);
}else{
digitalWrite(13, LOW);
}
Serial.println(sens);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment