Grove Air Quality Sensor.
Fork of Grove_Air_Quality_Sensor_Library by
Diff: Air_Quality.cpp
- Revision:
- 7:38425a51906f
- Parent:
- 4:0ca4a9fd1b5d
diff -r 34bf941285af -r 38425a51906f Air_Quality.cpp --- a/Air_Quality.cpp Tue Dec 27 12:55:56 2016 +0200 +++ b/Air_Quality.cpp Tue Dec 27 13:47:39 2016 +0200 @@ -23,6 +23,7 @@ AirQuality::AirQuality() { _s = 0; _sum_vol = 0; + _heating_delay_s = 20; } void AirQuality::set_calc_avg_volt_period(uint16_t seconds) { @@ -50,8 +51,8 @@ _pin = pin; AnalogIn sensor(_pin); unsigned char minutes = 0; - debug_if(DEBUG_AIR_QUALITY, "Air Quality Sensor Starting Up...(20s)"); - wait(20); + debug_if(DEBUG_AIR_QUALITY, "Air Quality Sensor Starting Up... (%d s)", _heating_delay_s); + wait(_heating_delay_s); init_voltage = (uint16_t) (sensor.read() * 1000); // boost the value to be on a 0 -> 1000 scale for compatibility debug_if(DEBUG_AIR_QUALITY, "The initial voltage is %d%% of source ", init_voltage / 10); while (init_voltage) { @@ -109,3 +110,7 @@ return ret; } +void AirQuality::set_heating_delay(uint16_t seconds) { + _heating_delay_s = seconds; +} +