Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: MiCS6814_GasSensor_Hello grove_multichannel_GasSensor
MiCS6814_GasSensor Class Reference
Interface for controlling MiCS-6814 Multichannel Gas Sensor. More...
#include <MiCS6814_GasSensor.h>
Public Member Functions | |
| MiCS6814_GasSensor (PinName sda, PinName scl, char slave_adr=SLAVE_ADDRESS_MiCS6814) | |
| Create a MiCS6814_GasSensor instance the sensor is connected to specified I2C pins with specified address. | |
| MiCS6814_GasSensor (I2C &i2c_obj, char slave_adr=SLAVE_ADDRESS_MiCS6814) | |
| Create a MiCS6814_GasSensor instance the sensor is connected to specified I2C pins with specified address. | |
| virtual | ~MiCS6814_GasSensor () |
| Destructor of MiCS6814_GasSensor. | |
| void | initialize (void) |
| Initialize MiCS6814_GasSensor Read firmware version from sensor and power on heater. | |
| float | getGas (const enum GAS_TYPE gas_type) |
| Return a specific measured value, unit: ppm. | |
Detailed Description
Interface for controlling MiCS-6814 Multichannel Gas Sensor.
#include "mbed.h" #include "MiCS6814_GasSensor.h" Serial pc(USBTX, USBRX); #if defined(TARGET_LPC1768) MiCS6814_GasSensor sensor(p28, p27); #else MiCS6814_GasSensor sensor(I2C_SDA, I2C_SCL); #endif int main() { while(1) { pc.printf("NH3: %.2f ppm, CO: %.2f ppm, NO2: %.2f ppm, C3H8: %.2f ppm \r\n", sensor.getGas(NH3), sensor.getGas(CO), sensor.getGas(NO2), sensor.getGas(C3H8)); pc.printf("C4H10: %.2f ppm, CH4: %.2f ppm, H2: %.2f ppm, C2H5OH: %.2f ppm \r\n", sensor.getGas(C4H10), sensor.getGas(CH4), sensor.getGas(H2), sensor.getGas(C2H5OH)); wait(1); } }
A mbed component library to measure concentration value for 8 type of gases by using MiCS6814 - Multichannel Gas Sensor (seeed)
Definition at line 125 of file MiCS6814_GasSensor.h.
Constructor & Destructor Documentation
| MiCS6814_GasSensor | ( | PinName | sda, |
| PinName | scl, | ||
| char | slave_adr = SLAVE_ADDRESS_MiCS6814 |
||
| ) |
Create a MiCS6814_GasSensor instance the sensor is connected to specified I2C pins with specified address.
- Parameters:
-
[in] sda I2C-bus SDA pin [in] scl I2C-bus SCL pin [in] slave_adr (option) I2C-bus address (default: 0x04<<1)
Definition at line 33 of file MiCS6814_GasSensor.cpp.
| MiCS6814_GasSensor | ( | I2C & | i2c_obj, |
| char | slave_adr = SLAVE_ADDRESS_MiCS6814 |
||
| ) |
Create a MiCS6814_GasSensor instance the sensor is connected to specified I2C pins with specified address.
- Parameters:
-
[in] i2c_obj I2C object (instance) [in] slave_adr (option) I2C-bus address (default: 0x04<<1)
Definition at line 42 of file MiCS6814_GasSensor.cpp.
| ~MiCS6814_GasSensor | ( | ) | [virtual] |
Destructor of MiCS6814_GasSensor.
Definition at line 51 of file MiCS6814_GasSensor.cpp.
Member Function Documentation
| float getGas | ( | const enum GAS_TYPE | gas_type ) |
Return a specific measured value, unit: ppm.
- Parameters:
-
[in] gas_type one of gas type defined at enum GAS_TYPE
- Returns:
- the measured concentration of specific gas type (ppm)
Definition at line 146 of file MiCS6814_GasSensor.cpp.
| void initialize | ( | void | ) |
Initialize MiCS6814_GasSensor Read firmware version from sensor and power on heater.
Definition at line 192 of file MiCS6814_GasSensor.cpp.
Generated on Sat Jul 16 2022 22:10:03 by
1.7.2
MiCS6814 MultiChannel Gas Sensor