Added test equation

This commit is contained in:
miguel5612
2020-03-26 20:13:27 -05:00
parent b992078540
commit a4ea39b2f4
3 changed files with 27 additions and 0 deletions

View File

@ -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

View File

@ -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();