Device driver for the MQ-3 alcohol sensor.
More...
Device driver for the MQ-3 alcohol sensor.
|
file | mq3.h |
| Device driver interface for the MQ-3 alcohol sensor.
|
|
|
int | mq3_init (mq3_t *dev, adc_t adc_line) |
| Initialize a MQ-3 alcohol sensor.
|
|
int16_t | mq3_read_raw (const mq3_t *dev) |
| Read the RAW sensor value, can be between 0 and MQ3_MAX_RAW_VALUE.
|
|
int16_t | mq3_read (const mq3_t *dev) |
| Read the scaled sensor value of PPM of alcohol.
|
|
◆ MQ3_MAX_RAW_VALUE
#define MQ3_MAX_RAW_VALUE (1023U) |
maximum unprocessed value fetched form the sensor
Definition at line 33 of file mq3.h.
◆ mq3_init()
Initialize a MQ-3 alcohol sensor.
The MQ-3 sensor is interfaced by a single ADC pin, specified by adc
and channel
.
- Note
- The sensor needs about a minute to heat up before meaningful measurements can be made.
- Parameters
-
[out] | dev | device descriptor of an MQ-3 sensor |
[in] | adc_line | the ADC device the sensor is connected to |
- Return values
-
◆ mq3_read()
int16_t mq3_read |
( |
const mq3_t * |
dev | ) |
|
Read the scaled sensor value of PPM of alcohol.
- Parameters
-
[in] | dev | device descriptor of the MQ-3 sensor to read from |
- Returns
- the scaled sensor value in PPM of alcohol
◆ mq3_read_raw()
int16_t mq3_read_raw |
( |
const mq3_t * |
dev | ) |
|
Read the RAW sensor value, can be between 0 and MQ3_MAX_RAW_VALUE.
- Parameters
-
[in] | dev | device descriptor of the MQ-3 sensor to read from |
- Returns
- the raw sensor value, between 0 and MQ3_MAX_RAW_VALUE