mirror of
https://github.com/miguel5612/MQSensorsLib.git
synced 2025-07-25 21:51:04 +03:00
Added test equation
This commit is contained in:
@ -86,6 +86,12 @@ void MQUnifiedsensor::update()
|
||||
{
|
||||
_sensor_volt = this->getVoltage();
|
||||
}
|
||||
float MQUnifiedsensor::calculatePPM(double ratio)
|
||||
{
|
||||
if(_regressionMethod == "Exponential") _PPM= _a*pow(ratio, _b);
|
||||
if(_regressionMethod == "Linear") _PPM= _a*ratio + _b;
|
||||
return _PPM;
|
||||
}
|
||||
float MQUnifiedsensor::readSensor()
|
||||
{
|
||||
//More explained in: https://jayconsystems.com/blog/understanding-a-gas-sensor
|
||||
|
@ -29,6 +29,7 @@ class MQUnifiedsensor
|
||||
//user functions
|
||||
float calibrate(float ratioInCleanAir);
|
||||
float readSensor();
|
||||
float calculatePPM(double ratio = 0);
|
||||
|
||||
//get function for info
|
||||
double getR0();
|
||||
|
Reference in New Issue
Block a user