MQ135 gas sensor

parent 50683c0e
int sensorValue;
int digitalValue;
void setup()
{
Serial.begin(9600); // sets the serial port to 9600
pinMode(13, OUTPUT);
}
void loop()
{
sensorValue = analogRead(3); // read analog input pin 3
if(sensorValue>300)
{
digitalWrite(13, HIGH);
}
else
digitalWrite(13, LOW);
Serial.println(sensorValue, DEC); // prints the value read
delay(1000); // wait 100ms for next reading
}
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