upm
1.7.1
Sensor/Actuator repository for libmraa (v2.0.0)
|
The mqx gas sensor driver can be used to read a wide range of sensors. The list below shows the currently supported sensors:
mq2: H2/LPG/CH4/CO/alcohol/smoke/propane/etc LPG/propane 200-5000 ppm butane 300-5000 ppm CH4 5000-2000 ppm H2 300-5000 ppm alcohol 100-2000 ppm mq3: Alcohol/benzine/CH4/hexane/LPG/CO .05-10 mg/L mq4: CNG (mostly methane) 200-10000 ppm mq5: H2/LPG/CH4/CO/alcohol 200-10000 ppm mq6: LPG (mostly propane/butane) 200-10000 ppm mq7: CO 20-2000 ppm mq8: H 100-10000 ppm mq9: CO/CH4/LPG 200-1000/10000/10000 ppm
Go to the source code of this file.
Data Structures | |
struct | _mqx_context |
Functions | |
mqx_context | mqx_init (int16_t pin) |
void | mqx_close (mqx_context dev) |
upm_result_t | mqx_set_aref (const mqx_context dev, float aref) |
upm_result_t | mqx_set_scale (const mqx_context dev, float scale) |
upm_result_t | mqx_set_offset (const mqx_context dev, float offset) |
float | mqx_get_aref (const mqx_context dev) |
float | mqx_get_scale (const mqx_context dev) |
float | mqx_get_offset (const mqx_context dev) |
upm_result_t | mqx_get_normalized (const mqx_context dev, float *value) |
upm_result_t | mqx_get_raw_volts (const mqx_context dev, float *value) |
upm_result_t | mqx_get_volts (const mqx_context dev, float *value) |
Typedefs | |
typedef struct _mqx_context * | mqx_context |
mqx_context mqx_init | ( | int16_t | pin | ) |
Initialize analog sensor
pin | Analog pin |
void mqx_close | ( | mqx_context | dev | ) |
Analog sensor destructor
sensor | context pointer |
upm_result_t mqx_set_aref | ( | const mqx_context | dev, |
float | aref | ||
) |
Set ADC reference voltage
dev | sensor context pointer |
aref | ADC reference voltage |
upm_result_t mqx_set_scale | ( | const mqx_context | dev, |
float | scale | ||
) |
Set sensor scale. This scale is applied to the return value: counts = counts * scale
dev | sensor context pointer |
scale | count scale value used |
upm_result_t mqx_set_offset | ( | const mqx_context | dev, |
float | offset | ||
) |
Set sensor offset. This offset is applied to the return value: counts = counts + offset
dev | sensor context pointer |
offset | count offset value used |
float mqx_get_aref | ( | const mqx_context | dev | ) |
Get sensor aref
dev | sensor context pointer |
float mqx_get_scale | ( | const mqx_context | dev | ) |
Get sensor scale
dev | sensor context pointer |
float mqx_get_offset | ( | const mqx_context | dev | ) |
Get sensor offset
dev | sensor context pointer |
upm_result_t mqx_get_normalized | ( | const mqx_context | dev, |
float * | value | ||
) |
Read normalized value for sensor
dev | sensor context pointer |
*value | Normalized value (0.0 -> 1.0) |
upm_result_t mqx_get_raw_volts | ( | const mqx_context | dev, |
float * | value | ||
) |
Read raw voltage from the sensor
dev | sensor context pointer |
*value | Raw sensor voltage |
upm_result_t mqx_get_volts | ( | const mqx_context | dev, |
float * | value | ||
) |
Read scaled/offset voltage from the sensor
dev | sensor context pointer |
*value | Adjusted sensor voltage |
typedef struct _mqx_context * mqx_context |
driver context