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.
|
|
◆ 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 |
- Returns
- 0 on success
-
-1 on error
◆ mq3_read()
int 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()
int 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