Sentinel
Loading...
Searching...
No Matches
mq2.h
Go to the documentation of this file.
1
9
10#ifndef SENSOR_MQ2
11#define SENSOR_MQ2
12
13#include "config.h"
14#include <Arduino.h>
15#include <MQUnifiedsensor.h>
16
23
24
26{
27public:
28 MQ2Sensor(uint8_t pin, const char *board = "ESP-32", float voltageResolution = 3.3,
29 uint8_t adcBitResolution = 12, const char *type = "MQ-2");
30 void update();
31 int getValue();
32 void begin();
33 void calibrate();
34
35private:
36 MQUnifiedsensor mq2;
37};
38
39#endif
void begin()
Initializes the MQ2 sensor.
Definition mq2.cpp:37
void update()
Updates the MQ2 sensor.
Definition mq2.cpp:73
void calibrate()
Calibrates the MQ2 sensor.
Definition mq2.cpp:52
int getValue()
Gets the value from the MQ2 sensor.
Definition mq2.cpp:85
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.
Definition mq2.cpp:24
Configuration Header File.