upm  0.4.1
Sensor/Actuator repository for libmraa (v0.8.0)
Public Member Functions | List of all members

API support for the Grove CO2 sensor. More...

Detailed Description

This class implements support for the Grove CO2 sensor.

Its CO2 detection range is 0-2,000 ppm. It requires a 2-3 minute warm-up time before reporting valid data.

mhz16.jpg

Public Member Functions

synchronized void delete ()
 
 MHZ16 (int uart)
 
boolean dataAvailable (long millis)
 
int readData (byte[] buffer)
 
int writeData (byte[] buffer)
 
boolean setupTty (int baud)
 
boolean setupTty ()
 
boolean verifyPacket (byte[] pkt)
 
boolean getData ()
 
int getGas ()
 
int getTemperature ()
 
void calibrateZeroPoint ()
 

Constructor & Destructor Documentation

MHZ16 ( int  uart)

MHZ16 constructor

Parameters
uartDefault UART to use (0 or 1)

Member Function Documentation

void calibrateZeroPoint ( )

Sets the zero point of the sensor

boolean dataAvailable ( long  millis)

Checks to see if there is data available for reading

Parameters
millisNumber of milliseconds to wait; 0 means no waiting.
Returns
True if there is data available for reading
boolean getData ( )

Queries the sensor and gets the gas (CO2) concentration and temperature data. Should be called before other "get" functions.

Returns
True if successful
int getGas ( )

Returns the gas (CO2) concentration data.

Returns
Gas concentration
int getTemperature ( )

Returns the temperature data.

Returns
Temperature in Celsius
boolean setupTty ( int  baud)

Sets up proper tty I/O modes and the baud rate. The default baud rate is 9,600 (B9600).

Parameters
baudDesired baud rate.
Returns
True if successful

The documentation for this class was generated from the following file: