Open eduardo31 opened 3 years ago
Hello @eduardo31 this library needed a cleanup a long time ago but I didn't do it since now. I have made some changes, can you try with the new code? As I said in a another issue, I am not longer in possession of this sensor but this, together with #4 seems like programming issue which I expect to have solved in the new version. If that is not the case, please tell me.
the values printing on serial are diferent then the ones returned: LPG:2689.00ppm CO:-22786.00ppm SMOKE:25400.00ppm 0.00 0.00 0.00 0.00 TIME MILLIS: 51785 LPG:550.00ppm CO:17836.00ppm SMOKE:6131.00ppm 0.00 0.00 0.00 0.00 TIME MILLIS: 55341 LPG:2100.00ppm CO:-28364.00ppm SMOKE:1688.00ppm 0.00 0.00 0.00 0.00
Code:
void ReadMQ2(){ float* values = mq2.read(true); //set it false if you don't want to print the values in the Serial Serial.println(values[0]); Serial.println(values[1]); Serial.println(values[2]); lpg = values[0]; co = values[1]; smoke = values[2];
Serial.println(String(co)); }