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.
Dependencies: mbed CCS811 BME280
Adafruit_SGP30 Class Reference
#include <Adafruit_SGP30.h>
Public Member Functions | |
| Adafruit_SGP30 (PinName sda, PinName scl) | |
| Instantiates a new SGP30 class. | |
| bool | begin () |
| Setups the hardware and detects a valid SGP30. Initializes I2C then reads the serialnumber and checks that we are talking to an SGP30. | |
| bool | IAQinit (void) |
| Commands the sensor to begin the IAQ algorithm. Must be called after startup. | |
| bool | IAQmeasure (void) |
| Commands the sensor to take a single eCO2/VOC measurement. Places results in TVOC and eCO2. | |
| bool | getIAQBaseline (uint16_t *eco2_base, uint16_t *tvoc_base) |
| Request baseline calibration values for both CO2 and TVOC IAQ calculations. Places results in parameter memory locaitons. | |
| bool | setIAQBaseline (uint16_t eco2_base, uint16_t tvoc_base) |
| Assign baseline calibration values for both CO2 and TVOC IAQ calculations. | |
Data Fields | |
| uint16_t | TVOC |
| The last measurement of the IAQ-calculated Total Volatile Organic Compounds in ppb. | |
| uint16_t | eCO2 |
| The last measurement of the IAQ-calculated equivalent CO2 in ppm. | |
| uint16_t | serialnumber [3] |
| The 48-bit serial number, this value is set when you call begin(). | |
Detailed Description
Class that stores state and functions for interacting with SGP30 Gas Sensor
Definition at line 35 of file Adafruit_SGP30.h.
Constructor & Destructor Documentation
| Adafruit_SGP30 | ( | PinName | sda, |
| PinName | scl | ||
| ) |
Instantiates a new SGP30 class.
Definition at line 38 of file Adafruit_SGP30.cpp.
Member Function Documentation
| bool begin | ( | ) |
Setups the hardware and detects a valid SGP30. Initializes I2C then reads the serialnumber and checks that we are talking to an SGP30.
- Parameters:
-
theWire Optional pointer to I2C interface, otherwise use Wire
- Returns:
- True if SGP30 found on I2C, False if something went wrong!
Definition at line 49 of file Adafruit_SGP30.cpp.
| bool getIAQBaseline | ( | uint16_t * | eco2_base, |
| uint16_t * | tvoc_base | ||
| ) |
Request baseline calibration values for both CO2 and TVOC IAQ calculations. Places results in parameter memory locaitons.
- Parameters:
-
eco2_base A pointer to a uint16_t which we will save the calibration value to tvoc_base A pointer to a uint16_t which we will save the calibration value to
- Returns:
- True if command completed successfully, false if something went wrong!
Definition at line 113 of file Adafruit_SGP30.cpp.
| bool IAQinit | ( | void | ) |
Commands the sensor to begin the IAQ algorithm. Must be called after startup.
- Returns:
- True if command completed successfully, false if something went wrong!
Definition at line 80 of file Adafruit_SGP30.cpp.
| bool IAQmeasure | ( | void | ) |
Commands the sensor to take a single eCO2/VOC measurement. Places results in TVOC and eCO2.
- Returns:
- True if command completed successfully, false if something went wrong!
Definition at line 93 of file Adafruit_SGP30.cpp.
| bool setIAQBaseline | ( | uint16_t | eco2_base, |
| uint16_t | tvoc_base | ||
| ) |
Assign baseline calibration values for both CO2 and TVOC IAQ calculations.
- Parameters:
-
eco2_base A uint16_t which we will save the calibration value from tvoc_base A uint16_t which we will save the calibration value from
- Returns:
- True if command completed successfully, false if something went wrong!
Definition at line 145 of file Adafruit_SGP30.cpp.
Field Documentation
| uint16_t eCO2 |
The last measurement of the IAQ-calculated equivalent CO2 in ppm.
This value is set when you call IAQmeasure()
Definition at line 54 of file Adafruit_SGP30.h.
| uint16_t serialnumber[3] |
The 48-bit serial number, this value is set when you call begin().
Definition at line 59 of file Adafruit_SGP30.h.
| uint16_t TVOC |
The last measurement of the IAQ-calculated Total Volatile Organic Compounds in ppb.
This value is set when you call IAQmeasure()
Definition at line 49 of file Adafruit_SGP30.h.
Generated on Tue Aug 2 2022 21:02:21 by
1.7.2