MQ-2 gas sensor readings all wrong on Photon but on Arduino its reading fine?

You also already got told in this thread that this is not the way to write this!

void loop() {
    valorSensor = analogRead(sensorPin);
    Serial.println(valorSensor);
    Particle.variable("valorSensor", valorSensor); // <-- DON'T DO THIS!!!
    delay(1000); //wait for a minute to see if no more gas is being detected (make it 10 for testing without having to wait a whole minute everytime)
    gasAlarm();
}
1 Like