UPM

The UPM API is a high level sensor library for IoT devices using MRAA. See examples here. Back to index page.
SparkFun sensor images provided under CC BY-NC-SA-3.0.

MQ303A Class

Module: mq303a

UPM module for the MQ303A alcohol sensor. This sensor needs to be warmed up before stable results are obtained. The higher the value returned from value() , the higher the amount of alcohol detected.
mq303a.jpg

Item Index

Methods

MQ303A

(
  • pin
  • heaterPin
)
Number

MQ303A constructor

Parameters:

  • pin Number

    Analog pin to use

  • heaterPin Number

    Digital pin mapped to the analog pin to use

Returns:

Number:

value

() Number

Gets the alcohol reading from the sensor. The value read from the analog pin is inverted. A higher returned value means a higher amount of alcohol detected.

Returns:

Number:

Alcohol reading

heaterEnable

(
  • enable
)

Enables the heater

Parameters:

  • enable Boolean

    Enables the heater if true; otherwise, disables it