Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
411 B
2
Indexable
Never
int LED = 13; 
int MQ2pin = A0;
void setup()
{
  Serial.begin(9600);
}
void loop()
{
  float sensorValue;
  sensorValue = analogRead(MQ2pin);
  if(sensorValue >= 250)
  {
    digitalWrite(LED,HIGH);
    Serial.print(sensorValue);
    Serial.println("  |GAS DETECTED");
  }
  else
  {
    digitalWrite(LED,LOW);
    Serial.print("Air quality in ppm is : ");
    Serial.println(sensorValue);
  }
  delay (1000);
}