|
Sentinel
|
Class for the MQ-2 gas sensor. More...
#include <mq2.h>
Public Member Functions | |
| MQ2Sensor (uint8_t pin, const char *board="ESP-32", float voltageResolution=3.3, uint8_t adcBitResolution=12, const char *type="MQ-2") | |
| Construct a new MQ2Sensor object. | |
| void | update () |
| Updates the MQ2 sensor. | |
| int | getValue () |
| Gets the value from the MQ2 sensor. | |
| void | begin () |
| Initializes the MQ2 sensor. | |
| void | calibrate () |
| Calibrates the MQ2 sensor. | |
Class for the MQ-2 gas sensor.
| MQ2Sensor::MQ2Sensor | ( | uint8_t | pin, |
| const char * | board = "ESP-32", | ||
| float | voltageResolution = 3.3, | ||
| uint8_t | adcBitResolution = 12, | ||
| const char * | type = "MQ-2" ) |
Construct a new MQ2Sensor object.
| pin | Pin number for the sensor |
| board | Board type (default is "ESP-32") |
| voltageResolution | Voltage resolution (default is 3.3) |
| adcBitResolution | ADC bit resolution (default is 12) |
| type | Sensor type (default is "MQ-2") |
| void MQ2Sensor::begin | ( | ) |
Initializes the MQ2 sensor.
Initializes the MQ2 sensor with the given parameters.
| void MQ2Sensor::calibrate | ( | ) |
Calibrates the MQ2 sensor.
Calibrates the MQ2 sensor by averaging 10 readings in clean air.
| int MQ2Sensor::getValue | ( | ) |
Gets the value from the MQ2 sensor.
Returns the value from the MQ2 sensor.
| void MQ2Sensor::update | ( | ) |
Updates the MQ2 sensor.
Updates the MQ2 sensor with the latest readings.