mirror of
https://github.com/miguel5612/MQSensorsLib.git
synced 2025-07-26 06:01:03 +03:00
Extend API for optional correction factor
This commit is contained in:
@ -78,24 +78,25 @@ void setup() {
|
||||
|
||||
void loop() {
|
||||
MQ135.update(); // Update data, the arduino will read the voltage from the analog pin
|
||||
float correctionFactor = 0; // Optional environmental correction
|
||||
|
||||
MQ135.setA(605.18); MQ135.setB(-3.937); // Configure the equation to calculate CO concentration value
|
||||
float CO = MQ135.readSensor(); // Sensor will read PPM concentration using the model, a and b values set previously or from the setup
|
||||
float CO = MQ135.readSensor(false, correctionFactor); // Sensor will read PPM concentration using the model, a and b values set previously or from the setup
|
||||
|
||||
MQ135.setA(77.255); MQ135.setB(-3.18); //Configure the equation to calculate Alcohol concentration value
|
||||
float Alcohol = MQ135.readSensor(); // SSensor will read PPM concentration using the model, a and b values set previously or from the setup
|
||||
float Alcohol = MQ135.readSensor(false, correctionFactor); // SSensor will read PPM concentration using the model, a and b values set previously or from the setup
|
||||
|
||||
MQ135.setA(110.47); MQ135.setB(-2.862); // Configure the equation to calculate CO2 concentration value
|
||||
float CO2 = MQ135.readSensor(); // Sensor will read PPM concentration using the model, a and b values set previously or from the setup
|
||||
float CO2 = MQ135.readSensor(false, correctionFactor); // Sensor will read PPM concentration using the model, a and b values set previously or from the setup
|
||||
|
||||
MQ135.setA(44.947); MQ135.setB(-3.445); // Configure the equation to calculate Toluen concentration value
|
||||
float Toluen = MQ135.readSensor(); // Sensor will read PPM concentration using the model, a and b values set previously or from the setup
|
||||
float Toluen = MQ135.readSensor(false, correctionFactor); // Sensor will read PPM concentration using the model, a and b values set previously or from the setup
|
||||
|
||||
MQ135.setA(102.2 ); MQ135.setB(-2.473); // Configure the equation to calculate NH4 concentration value
|
||||
float NH4 = MQ135.readSensor(); // Sensor will read PPM concentration using the model, a and b values set previously or from the setup
|
||||
float NH4 = MQ135.readSensor(false, correctionFactor); // Sensor will read PPM concentration using the model, a and b values set previously or from the setup
|
||||
|
||||
MQ135.setA(34.668); MQ135.setB(-3.369); // Configure the equation to calculate Aceton concentration value
|
||||
float Aceton = MQ135.readSensor(); // Sensor will read PPM concentration using the model, a and b values set previously or from the setup
|
||||
float Aceton = MQ135.readSensor(false, correctionFactor); // Sensor will read PPM concentration using the model, a and b values set previously or from the setup
|
||||
Serial.print("| "); Serial.print(CO);
|
||||
Serial.print(" | "); Serial.print(Alcohol);
|
||||
// Note: 400 Offset for CO2 source: https://github.com/miguel5612/MQSensorsLib/issues/29
|
||||
|
Reference in New Issue
Block a user