Skip to content

Latest commit

 

History

History
1349 lines (904 loc) · 53.2 KB

api.md

File metadata and controls

1349 lines (904 loc) · 53.2 KB

Summary

Members Descriptions
class I2CDevice Class for interacting with I2C devices.
class IndoorAirQualitySensor Represents an indoor air quality sensor.
class NiclaSenseEnv The NiclaSenseEnv class represents a NiclaSenseEnv device.
class OrangeLED Represents the orange on-board LED controlled via I2C.
class OutdoorAirQualitySensor Class representing an outdoor air quality sensor (ZMOD4510)
class RGBLED Represents the on-board RGB LED that can be controlled using I2C communication.
class TemperatureHumiditySensor Represents a temperature and humidity sensor.
struct LEDColor Represents a color with red, green, and blue components.
struct RegisterInfo Structure representing information about a register.

class I2CDevice

Class for interacting with I2C devices.

This class provides methods for reading and writing to registers of an I2C device. It also includes a method for checking if the device is connected.

Summary

Members Descriptions
I2CDevice Constructs an instance of the I2CDevice class.
I2CDevice Constructs an I2CDevice object with the specified device address.
connected Checks if the device is connected to the I2C bus.
begin Initializes the I2C communication and checks if the device is connected.
deviceAddress Get the I2C device address.

Members

I2CDevice

I2CDevice(TwoWire & bus, uint8_t deviceAddress)

Constructs an instance of the I2CDevice class.

Parameters

  • bus The I2C bus to use (default is Wire).

  • deviceAddress The address of the I2C device (default is DEFAULT_DEVICE_ADDRESS).


I2CDevice

I2CDevice(uint8_t deviceAddress)

Constructs an I2CDevice object with the specified device address.

Parameters

  • deviceAddress The address of the I2C device.

connected

bool connected()

Checks if the device is connected to the I2C bus.

Returns

true if the device is connected, false otherwise.


begin

bool begin()

Initializes the I2C communication and checks if the device is connected.

Returns

true if the device is connected after initialization, false otherwise.


deviceAddress

uint8_t deviceAddress() const

Get the I2C device address.

Returns

uint8_t The I2C device address.


class IndoorAirQualitySensor

class IndoorAirQualitySensor
  : public I2CDevice

Represents an indoor air quality sensor.

The IndoorAirQualitySensor class provides methods to retrieve various air quality parameters such as sulfur odor, odor intensity, ethanol level, CO2 level, TVOC level, air quality index, and more. It also allows setting the mode of the sensor and enabling/disabling it.

Summary

Members Descriptions
IndoorAirQualitySensor Constructor for the IndoorAirQualitySensor class.
IndoorAirQualitySensor Constructor for the IndoorAirQualitySensor class.
sulfurOdor Get the sulfur odor-detected value (true or false)
odorIntensity Get the odor intensity value.
ethanol Get the ethanol value.
CO2 Get the CO2 value in ppm.
TVOC Get the TVOC value in (mg/m3)
airQuality Get the air quality value. The common range is 0 to ~5.
airQualityInterpreted Get the interpreted air quality value. The possible values are "Very Good", "Good", "Medium", "Poor" and "Bad".
relativeAirQuality Get the relative air quality value in percent (0 - 100%).
mode Get the mode of the IndoorAirQualitySensor.
setMode Set the mode of the IndoorAirQualitySensor.
modeString Get the mode as a string. The possible values are "powerDown", "cleaning", "indoorAirQuality", "indoorAirQualityLowPower", "sulfur" and "unknown".
enabled Check if the sensor is enabled.
setEnabled Set the sensor enabled or disabled. When the sensor is enabled after being disabled, the sensor will go back to the indoorAirQuality mode.

Members

IndoorAirQualitySensor

IndoorAirQualitySensor(TwoWire & bus, uint8_t deviceAddress)

Constructor for the IndoorAirQualitySensor class.

Parameters

  • bus The I2C bus to use.

  • deviceAddress The I2C address of the device.


IndoorAirQualitySensor

IndoorAirQualitySensor(uint8_t deviceAddress)

Constructor for the IndoorAirQualitySensor class.

Parameters

  • deviceAddress The I2C address of the device.

sulfurOdor

bool sulfurOdor()

Get the sulfur odor-detected value (true or false)

Returns

The sulfur odor value.


odorIntensity

float odorIntensity()

Get the odor intensity value.

Returns

The odor intensity value.


ethanol

float ethanol()

Get the ethanol value.

Returns

The ethanol value.


CO2

float CO2()

Get the CO2 value in ppm.

Returns

The CO2 value.


TVOC

float TVOC()

Get the TVOC value in (mg/m3)

Returns

The TVOC value.


airQuality

float airQuality()

Get the air quality value. The common range is 0 to ~5.

Returns

The air quality value.


airQualityInterpreted

String airQualityInterpreted()

Get the interpreted air quality value. The possible values are "Very Good", "Good", "Medium", "Poor" and "Bad".

Returns

The interpreted air quality value.


relativeAirQuality

float relativeAirQuality()

Get the relative air quality value in percent (0 - 100%).

Returns

The relative air quality value.


mode

IndoorAirQualitySensorMode mode()

Get the mode of the IndoorAirQualitySensor.

Returns

The mode of the IndoorAirQualitySensor as an enum value.


setMode

bool setMode(IndoorAirQualitySensorMode sensorMode, bool persist)

Set the mode of the IndoorAirQualitySensor.

Note on cleaning mode: The cleaning mode performs a thermal cleaning cycle of the MOx element. It can eliminate some light pollution residues from production and packaging and improves the stabilization processes in the sensor. The function heats up the sensor to allow thermal desorption and catalytic combustion of the residues. The cleaning cycle can be executed only once in the sensor lifetime and shall be started after product assembly. Please ensure cleaning was completed before power-off/reset and do not interrupt while cleaning. The cleaning procedure takes 1 minute (blocking).

Note on PBAQ mode: The PBAQ mode is a special mode to perform highly accurate and consistent air quality readings. It measures the total volatile organic compounds (TVOC) and equivalent ethanol (EtOH) concentration to meet Public Building Air Quality (PBAQ) standards.

Note on low power IAQ mode: This mode offers a much lower power consumption while keeping accurate and consistent sensor readings. For more accurate readings, use the default indoor air quality mode.

Parameters

  • sensorMode The mode to set. See the IndoorAirQualitySensorMode enum class for possible values.

  • persist If true, the change will be saved to flash memory. When persist is true, the mode setting of OutdoorAirQualitySensor and TemperatureHumiditySensor will also be persisted.

Returns

True if the mode was set successfully, false otherwise.


modeString

String modeString()

Get the mode as a string. The possible values are "powerDown", "cleaning", "indoorAirQuality", "indoorAirQualityLowPower", "sulfur" and "unknown".

Returns

The mode as a string.


enabled

bool enabled()

Check if the sensor is enabled.

Returns

True if the sensor is enabled, false otherwise.


setEnabled

bool setEnabled(bool isEnabled, bool persist)

Set the sensor enabled or disabled. When the sensor is enabled after being disabled, the sensor will go back to the indoorAirQuality mode.

Parameters

  • isEnabled True to enable the sensor, false to disable it.

  • persist If true, the change will be saved to flash memory. When persist is true, the mode setting of IndoorAirQualitySensor and TemperatureHumiditySensor will also be persisted.

Returns

True if the the sensor was enabled successfully.


class NiclaSenseEnv

class NiclaSenseEnv
  : public I2CDevice

The NiclaSenseEnv class represents a NiclaSenseEnv device.

This class provides methods to interact with the device to enable and disable features, query device information and retrieve sensor objects. It inherits from the I2CDevice class.

Summary

Members Descriptions
NiclaSenseEnv Constructs a new NiclaSenseEnv object.
NiclaSenseEnv Constructs a new NiclaSenseEnv object.
~NiclaSenseEnv Destroy the Nicla Sense Env object. This will call the end() method while frees up allocated resources.
temperatureHumiditySensor Returns the TemperatureHumiditySensor object to interact with the temperature and humidity sensor.
indoorAirQualitySensor Returns the IndoorAirQualitySensor object to interact with the indoor air quality sensor.
outdoorAirQualitySensor Returns the OutdoorAirQualitySensor object to interact with the outdoor air quality sensor.
rgbLED Returns the RGBLED object to interact with the RGB LED.
orangeLED Returns a reference to the OrangeLED object to interact with the orange LED.
end Ends the operation of the NiclaSenseEnv class.
persistSettings Writes the current configuration to the flash memory. Stores board register 0x00 … 0x0B in flash to be default after reset.
serialNumber Retrieves the serial number of the device.
productID Gets the numeric product ID.
softwareRevision Get the software revision number.
reset Performs a soft reset of the device. Changes to the configuration that were not stored in flash will be lost.
deepSleep Puts the device into deep sleep mode.
restoreFactorySettings Restores the factory settings. This will reset among other properties the device address to the default value. See persistSettings() for a complete list of properties that are affected by this method.
UARTBaudRate Get the current baud rate of the UART communication. The supported values are: 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200.
setUARTBaudRate Sets the baud rate for the UART communication.
isUARTCSVOutputEnabled Checks if UART CSV output is enabled.
setUARTCSVOutputEnabled Sets the UART CSV output enabled or disabled. Enables or disables CSV output over UART.
CSVDelimiter Gets the CSV delimiter character. The default value is ','.
setCSVDelimiter Sets the CSV delimiter for parsing CSV data.
isDebuggingEnabled Checks if debugging is enabled. When debugging mode is enabled, the board will send additional debug messages over UART.
setDebuggingEnabled Toggles the debugging mode. When debugging mode is enabled, the board will send additional debug messages over UART.
setDeviceAddress Sets the I2C address of the device.

Members

NiclaSenseEnv

NiclaSenseEnv(TwoWire & bus, uint8_t deviceAddress)

Constructs a new NiclaSenseEnv object.

Parameters

  • bus The I2C bus to use (default is Wire).

  • deviceAddress The I2C device address (default is 0x21).


NiclaSenseEnv

NiclaSenseEnv(uint8_t deviceAddress)

Constructs a new NiclaSenseEnv object.

Parameters


~NiclaSenseEnv

~NiclaSenseEnv()

Destroy the Nicla Sense Env object. This will call the end() method while frees up allocated resources.


temperatureHumiditySensor

TemperatureHumiditySensor & temperatureHumiditySensor()

Returns the TemperatureHumiditySensor object to interact with the temperature and humidity sensor.

Returns

The TemperatureHumiditySensor object.


indoorAirQualitySensor

IndoorAirQualitySensor & indoorAirQualitySensor()

Returns the IndoorAirQualitySensor object to interact with the indoor air quality sensor.

Returns

A reference to the IndoorAirQualitySensor object.


outdoorAirQualitySensor

OutdoorAirQualitySensor & outdoorAirQualitySensor()

Returns the OutdoorAirQualitySensor object to interact with the outdoor air quality sensor.

Returns

The OutdoorAirQualitySensor object.


rgbLED

RGBLED & rgbLED()

Returns the RGBLED object to interact with the RGB LED.

Returns

RGBLED& The reference to the RGBLED object.


orangeLED

OrangeLED & orangeLED()

Returns a reference to the OrangeLED object to interact with the orange LED.

Returns

OrangeLED& Reference to the OrangeLED object.


end

void end()

Ends the operation of the NiclaSenseEnv class.

This function is used to gracefully end the operation of the NiclaSenseEnv class. It performs any necessary cleanup to free up resources. It gets called automatically when the object is destroyed.


persistSettings

bool persistSettings()

Writes the current configuration to the flash memory. Stores board register 0x00 … 0x0B in flash to be default after reset.

This affects the following properties:

  • UART baud rate

  • UART CSV output enabled

  • CSV delimiter

  • UART Debugging enabled

  • I2C Device address

  • Indoor air quality sensor mode

  • Outdoor air quality sensor mode

  • Temperature sensor enabled

  • Orange LED brightness

  • Orange LED error status enabled

  • RGB LED brightness

  • RGB LED color

Make sure all these properties are in the desired state before calling this method.

Returns

true if the settings were successfully stored, false otherwise.


serialNumber

String serialNumber()

Retrieves the serial number of the device.

Returns

The serial number as a String.


productID

int productID()

Gets the numeric product ID.

Returns

The product ID.


softwareRevision

int softwareRevision()

Get the software revision number.

Returns

The software revision number.


reset

void reset()

Performs a soft reset of the device. Changes to the configuration that were not stored in flash will be lost.


deepSleep

void deepSleep()

Puts the device into deep sleep mode.

This function puts the device into deep sleep mode, conserving power by disabling most of its functionalities. It is commonly used to prolong the battery life of battery-powered devices. The board can only be woken up by a hardware reset.


restoreFactorySettings

bool restoreFactorySettings()

Restores the factory settings. This will reset among other properties the device address to the default value. See persistSettings() for a complete list of properties that are affected by this method.

Returns

true if the factory settings were successfully restored, false otherwise.


UARTBaudRate

int UARTBaudRate()

Get the current baud rate of the UART communication. The supported values are: 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200.

Returns

int The UART Baud Rate.


setUARTBaudRate

bool setUARTBaudRate(int baudRate, bool persist)

Sets the baud rate for the UART communication.

Parameters

  • baudRate The desired baud rate for the UART communication. The supported values are: 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200

  • persist Set to true to store the setting in flash, to false otherwise.

Returns

True if the baud rate was set successfully, false otherwise.


isUARTCSVOutputEnabled

bool isUARTCSVOutputEnabled()

Checks if UART CSV output is enabled.

Returns

true if UART CSV output is enabled, false otherwise.


setUARTCSVOutputEnabled

bool setUARTCSVOutputEnabled(bool enabled, bool persist)

Sets the UART CSV output enabled or disabled. Enables or disables CSV output over UART.

The column names and their order are: HS4001 sample counter, HS4001 temperature (degC), HS4001 humidity (RH), ZMOD4510 status, ZMOD4510 sample counter, ZMOD4510 EPA AQI, ZMOD4510 Fast AQI, ZMOD4510 O3 (ppb), ZMOD4510 NO2 (ppb), ZMOD4510 Rmox[0], ZMOD4510 Rmox[1], ZMOD4510 Rmox[2], ZMOD4510 Rmox[3], ZMOD4510 Rmox[4], ZMOD4510 Rmox[5], ZMOD4510 Rmox[6], ZMOD4510 Rmox[7], ZMOD4510 Rmox[8], ZMOD4510 Rmox[9], ZMOD4510 Rmox[10], ZMOD4510 Rmox[11], ZMOD4510 Rmox[12], ZMOD4410 status, ZMD4410 sample counter, ZMOD4410 IAQ, ZMOD4410 TVOC (mg/m^3), ZMOD4410 eCO2 (ppm), ZMOD4410 Rel IAQ, ZMOD4410 EtOH (ppm), ZMOD4410 Rmox[0], ZMOD4410 Rmox[1], ZMOD4410 Rmox[2], ZMOD4410 Rmox[3], ZMOD4410 Rmox[4], ZMOD4410 Rmox[5], ZMOD4410 Rmox[6], ZMOD4410 Rmox[7], ZMOD4410 Rmox[8], ZMOD4410 Rmox[9], ZMOD4410 Rmox[10], ZMOD4410 Rmox[11], ZMOD4410 Rmox[12], ZMOD4410 Rcda[0], ZMOD4410 Rcda[1], ZMOD4410 Rcda[2], ZMOD4410 Rhtr, ZMOD4410 Temp, ZMOD4410 intensity, ZMOD4410 odor The csv formatted line is sent when a sensor finishes a measurement. Only the columns for this sensor will be filled, the other columns will be empty.

Parameters

  • enabled True to enable UART CSV output, false to disable.

  • persist True to store the setting in flash, false otherwise. When set to True, it will also persist the value set via setDebuggingEnabled.

Returns

True if the CSV output mode was set successfully, false otherwise.


CSVDelimiter

char CSVDelimiter()

Gets the CSV delimiter character. The default value is ','.

Returns

The CSV delimiter character.


setCSVDelimiter

bool setCSVDelimiter(char delimiter, bool persist)

Sets the CSV delimiter for parsing CSV data.

Parameters

  • delimiter The character to be used as the CSV delimiter.

  • persist If true, the change will be saved to flash memory.

Returns

True if the delimiter was set successfully, false otherwise.


isDebuggingEnabled

bool isDebuggingEnabled()

Checks if debugging is enabled. When debugging mode is enabled, the board will send additional debug messages over UART.

Returns

true if debugging is enabled, false otherwise.


setDebuggingEnabled

bool setDebuggingEnabled(bool enabled, bool persist)

Toggles the debugging mode. When debugging mode is enabled, the board will send additional debug messages over UART.

Parameters

  • enabled A boolean value indicating whether debugging is enabled or not.

  • persist If true, the change will be saved to flash memory. When setting this to true the value set via setUARTCSVOutputEnabled will also be persisted.

Returns

True if the debugging mode was set successfully, false otherwise.


setDeviceAddress

bool setDeviceAddress(int address, bool persist)

Sets the I2C address of the device.

Parameters

  • address The new I2C address. Valid values are 0 to 127.

  • persist If true, the change will be saved to flash memory.

Returns

True if the address was set successfully, false otherwise.


class OrangeLED

class OrangeLED
  : public I2CDevice

Represents the orange on-board LED controlled via I2C.

The OrangeLED class provides methods to control the brightness and error status of the orange LED. It inherits from the I2CDevice class.

Summary

Members Descriptions
OrangeLED Constructs a OrangeLED object.
OrangeLED Constructs a OrangeLED object with the specified device address.
brightness Gets the brightness of the orange LED.
setBrightness Sets the brightness of the orange LED. When persist is true, the errorStatusEnabled setting will also be persisted.
errorStatusEnabled Determines whether the orange LED is used to indicate an error status of one of the sensors. When a board error condition occurs the LED blinks, independently of the brightness setting.
setErrorStatusEnabled Enables or disables the orange LED to indicate an error status of one of the sensors. When persist is true, the brightness setting will also be saved to flash memory.

Members

OrangeLED

OrangeLED(TwoWire & bus, uint8_t deviceAddress)

Constructs a OrangeLED object.

Parameters

  • bus The I2C bus to use (default is Wire).

  • deviceAddress The I2C device address (default is 0x21).


OrangeLED

OrangeLED(uint8_t deviceAddress)

Constructs a OrangeLED object with the specified device address.

Parameters

  • deviceAddress The I2C address of the OrangeLED device.

brightness

uint8_t brightness()

Gets the brightness of the orange LED.

Returns

The brightness of the orange LED. Range is 0 to 255.


setBrightness

bool setBrightness(uint8_t brightness, bool persist)

Sets the brightness of the orange LED. When persist is true, the errorStatusEnabled setting will also be persisted.

Parameters

  • brightness : The brightness of the orange LED. Range is 0 to 255.

  • persist : If true, the brightness setting will be saved to flash memory.

Returns

True if the brightness was set successfully, false otherwise.


errorStatusEnabled

bool errorStatusEnabled()

Determines whether the orange LED is used to indicate an error status of one of the sensors. When a board error condition occurs the LED blinks, independently of the brightness setting.

Returns

True if the orange LED is used for error status, false otherwise.


setErrorStatusEnabled

bool setErrorStatusEnabled(bool enabled, bool persist)

Enables or disables the orange LED to indicate an error status of one of the sensors. When persist is true, the brightness setting will also be saved to flash memory.

Parameters

  • enabled : Whether to enable or disable the orange LED error status.

  • persist : If true, the change will be saved to flash memory.

Returns

True if the mode was set successfully, false otherwise.


class OutdoorAirQualitySensor

class OutdoorAirQualitySensor
  : public I2CDevice

Class representing an outdoor air quality sensor (ZMOD4510)

This class provides functionality to interact with an outdoor air quality sensor. It allows reading the air quality data from the sensor.

Summary

Members Descriptions
OutdoorAirQualitySensor Constructs an instance of the OutdoorAirQualitySensor class.
OutdoorAirQualitySensor Constructs an instance of the OutdoorAirQualitySensor class.
airQualityIndex Retrieves the EPA air quality index. Range is 0 to 500. The" EPA AQI" is strictly following the EPA standard and is based on the 1-hour or 8-hour average of the O3 concentrations (concentration dependent).
airQualityIndexInterpreted Gets the outdoor air quality index from the ZMOD4510 sensor and interprets it in terms of air quality.
fastAirQualityIndex Get the fast air quality index. Range is 0 to 500. As the standard averaging leads to a very slow response, especially during testing and evaluation, "Fast AQI" provides quicker results with a 1-minute averaging.
NO2 Get the NO2 value from the outdoor air quality sensor.
O3 Get the O3 value from the outdoor air quality sensor.
mode Get the mode of the outdoor air quality sensor. Possible values are: powerDown, cleaning, outdoorAirQuality. The default mode is powerDown. This is because the sensor needs several hours to start outputting valuable data due to the sensor's internal algorithm and chemical compound. This property represents the numeric value of the mode. See OutdoorAirQualitySensorMode for more information.
setMode Sets the mode of the outdoor air quality sensor.
modeString Gets the outdoor air quality sensor mode as a string.
enabled Checks if the outdoor air quality sensor is enabled.
setEnabled Sets the enabled state of the outdoor air quality sensor. When disabled the sensor goes in power down mode. When the sensor is enabled after being disabled, the sensor will go back to the outdoorAirQuality mode.

Members

OutdoorAirQualitySensor

OutdoorAirQualitySensor(TwoWire & bus, uint8_t deviceAddress)

Constructs an instance of the OutdoorAirQualitySensor class.

Parameters

  • bus The I2C bus to which the sensor is connected. Defaults to Wire.

  • deviceAddress The I2C device address of the sensor. Defaults to 0x21.


OutdoorAirQualitySensor

OutdoorAirQualitySensor(uint8_t deviceAddress)

Constructs an instance of the OutdoorAirQualitySensor class.

Parameters

  • deviceAddress The address of the sensor device.

airQualityIndex

int airQualityIndex()

Retrieves the EPA air quality index. Range is 0 to 500. The" EPA AQI" is strictly following the EPA standard and is based on the 1-hour or 8-hour average of the O3 concentrations (concentration dependent).

Returns

The air quality index as an integer.


airQualityIndexInterpreted

String airQualityIndexInterpreted()

Gets the outdoor air quality index from the ZMOD4510 sensor and interprets it in terms of air quality.

Returns

The interpreted air quality index as a string. Possible values are: Good, Moderate, Unhealthy for Sensitive Groups, Unhealthy, Very Unhealthy, Hazardous.


fastAirQualityIndex

int fastAirQualityIndex()

Get the fast air quality index. Range is 0 to 500. As the standard averaging leads to a very slow response, especially during testing and evaluation, "Fast AQI" provides quicker results with a 1-minute averaging.

Returns

int The fast air quality index.


NO2

float NO2()

Get the NO2 value from the outdoor air quality sensor.

Returns

The NO2 concentration in ppb.


O3

float O3()

Get the O3 value from the outdoor air quality sensor.

Returns

The O3 concentration in ppb.


mode

OutdoorAirQualitySensorMode mode()

Get the mode of the outdoor air quality sensor. Possible values are: powerDown, cleaning, outdoorAirQuality. The default mode is powerDown. This is because the sensor needs several hours to start outputting valuable data due to the sensor's internal algorithm and chemical compound. This property represents the numeric value of the mode. See OutdoorAirQualitySensorMode for more information.

Returns

OutdoorAirQualitySensorMode The mode of the sensor.


setMode

bool setMode(OutdoorAirQualitySensorMode sensorMode, bool persist)

Sets the mode of the outdoor air quality sensor.

This function allows you to set the mode of the outdoor air quality sensor. Possible values are: powerDown, cleaning, outdoorAirQuality. See OutdoorAirQualitySensorMode for more information.

Note on cleaning mode: The cleaning mode performs a thermal cleaning cycle of the MOx element. It can eliminate some light pollution residues from production and packaging and improves the stabilization processes in the sensor. The function heats up the sensor to allow thermal desorption and catalytic combustion of the residues. The cleaning cycle can be executed only once in the sensor lifetime and shall be started after product assembly. Please ensure cleaning was completed before power-off/reset and do not interrupt while cleaning. The cleaning procedure takes 1 minute (blocking).

Parameters

Returns

True if the mode was set successfully, false otherwise.


modeString

String modeString()

Gets the outdoor air quality sensor mode as a string.

Returns

The mode as string. Possible values are: powerDown, cleaning, outdoorAirQuality.


enabled

bool enabled()

Checks if the outdoor air quality sensor is enabled.

Returns

true if the sensor is enabled, false otherwise.


setEnabled

bool setEnabled(bool isEnabled, bool persist)

Sets the enabled state of the outdoor air quality sensor. When disabled the sensor goes in power down mode. When the sensor is enabled after being disabled, the sensor will go back to the outdoorAirQuality mode.

Parameters

  • isEnabled True to enable the sensor, false to disable it.

  • persist If true, the change will be saved to flash memory. When persist is true, the mode setting of IndoorAirQualitySensor and TemperatureHumiditySensor will also be persisted.

Returns

True if the enabled state was set successfully, false otherwise.


class RGBLED

class RGBLED
  : public I2CDevice

Represents the on-board RGB LED that can be controlled using I2C communication.

The RGBLED class provides methods to control the color and brightness of the LED, as well as enable features like indoor air quality status indicator. It inherits from the I2CDevice class and can be used with an I2C bus to communicate with the RGB LED device.

Summary

Members Descriptions
RGBLED Constructs an instance of the RGBLED class.
RGBLED Initializes an instance of the RGBLED class with the specified device address.
enableIndoorAirQualityStatus Enables the indoor air quality status indicator on the RGB LED. When enabled, the RGB LED will change color based on the air quality (red = bad, green = good)
setColor Sets the RGB values of the LED.
setColor Sets the RGB color of the LED using a LEDColor object. The LEDColor object contains the red, green, and blue values that can be changed individually. Note: A value of 0, 0, 0 will set the color based on the IAQ value from the Indoor Air Quality sensor.
color Gets the current RGB color of the LED.
brightness Get the brightness of the RGB LED (0-255)
setBrightness Sets the brightness of the RGB LED. This function allows you to adjust the brightness of the RGB LED.

Members

RGBLED

RGBLED(TwoWire & bus, uint8_t deviceAddress)

Constructs an instance of the RGBLED class.

Parameters

  • bus The I2C bus to communicate with the RGBLED device. Default is Wire.

  • deviceAddress The I2C address of the RGBLED device. Default is DEFAULT_DEVICE_ADDRESS.


RGBLED

RGBLED(uint8_t deviceAddress)

Initializes an instance of the RGBLED class with the specified device address.

Parameters

  • deviceAddress The address of the RGB LED device.

enableIndoorAirQualityStatus

bool enableIndoorAirQualityStatus(uint8_t brightness, bool persist)

Enables the indoor air quality status indicator on the RGB LED. When enabled, the RGB LED will change color based on the air quality (red = bad, green = good)

Parameters

  • brightness The brightness level of the indicator (0-255).

  • persist If true, the change will be saved to flash memory. When persist is True, the brightness will also be persisted.

Returns

True if the mode was set successfully, false otherwise.


setColor

bool setColor(uint8_t r, uint8_t g, uint8_t b, bool persist)

Sets the RGB values of the LED.

This function sets the red, green, and blue values of the LED using individual values. Note: A value of 0, 0, 0 will set the color based on the IAQ value from the Indoor Air Quality sensor.

Parameters

  • r The red value (0-255).

  • g The green value (0-255).

  • b The blue value (0-255).

  • persist If true, the change will be saved to flash memory.

Returns

True if the color was set successfully, false otherwise.


setColor

bool setColor( LEDColor color, bool persist)

Sets the RGB color of the LED using a LEDColor object. The LEDColor object contains the red, green, and blue values that can be changed individually. Note: A value of 0, 0, 0 will set the color based on the IAQ value from the Indoor Air Quality sensor.

Parameters

  • color The RGB color to set.

  • persist If true, the change will be saved to flash memory.

Returns

True if the color was set successfully, false otherwise.


color

LEDColor color()

Gets the current RGB color of the LED.

Returns

The current RGB color as a LEDColor object.


brightness

uint8_t brightness()

Get the brightness of the RGB LED (0-255)

Returns

The brightness value as a uint8_t.


setBrightness

bool setBrightness(uint8_t brightness, bool persist)

Sets the brightness of the RGB LED. This function allows you to adjust the brightness of the RGB LED.

Parameters

  • brightness The brightness level to set (0-255).

  • persist If true, the change will be saved to flash memory.

Returns

True if the brightness was set successfully, false otherwise.


class TemperatureHumiditySensor

class TemperatureHumiditySensor
  : public I2CDevice

Represents a temperature and humidity sensor.

This class provides methods to interact with a temperature and humidity sensor connected via I2C communication. It inherits from the I2CDevice class.

Summary

Members Descriptions
TemperatureHumiditySensor Constructs a TemperatureHumiditySensor object.
TemperatureHumiditySensor Constructs a TemperatureHumiditySensor object with the specified device address.
temperature Get the temperature value from the sensor in degrees Celsius.
humidity Get the relative humidity value (Range 0-100%).
enabled Checks if the temperature and humidity sensor is enabled.
setEnabled Sets the enabled state of the temperature and humidity sensor. When disabled the sensor goes in power down mode. When persist is true, the mode setting of IndoorAirQualitySensor and OutdoorAirQualitySensor will also be persisted.

Members

TemperatureHumiditySensor

TemperatureHumiditySensor(TwoWire & bus, uint8_t deviceAddress)

Constructs a TemperatureHumiditySensor object.

Parameters

  • bus The I2C bus to communicate with the sensor. Default is Wire.

  • deviceAddress The I2C address of the sensor. Default is 0x21.


TemperatureHumiditySensor

TemperatureHumiditySensor(uint8_t deviceAddress)

Constructs a TemperatureHumiditySensor object with the specified device address.

Parameters

  • deviceAddress The I2C address of the temperature and humidity sensor.

temperature

float temperature()

Get the temperature value from the sensor in degrees Celsius.

Returns

float The temperature value.


humidity

float humidity()

Get the relative humidity value (Range 0-100%).

Returns

The humidity value as a float.


enabled

bool enabled()

Checks if the temperature and humidity sensor is enabled.

Returns

true if the sensor is enabled, false otherwise.


setEnabled

bool setEnabled(bool enabled, bool persist)

Sets the enabled state of the temperature and humidity sensor. When disabled the sensor goes in power down mode. When persist is true, the mode setting of IndoorAirQualitySensor and OutdoorAirQualitySensor will also be persisted.

Parameters

  • enabled The desired enabled state. True to enable the sensor, false to disable it.

  • persist If true, the change will be saved to flash memory.

Returns

true if the operation was successful, false otherwise.


struct LEDColor

Represents a color with red, green, and blue components.

Summary

Members Descriptions
red The red component of the color.
green The green component of the color.
blue The blue component of the color.

Members

red

uint8_t red

The red component of the color.


green

uint8_t green

The green component of the color.


blue

uint8_t blue

The blue component of the color.


struct RegisterInfo

Structure representing information about a register.

Summary

Members Descriptions
address The address of the register.
type The data type of the register.
bytes The number of bytes of the register.

Members

address

uint8_t address

The address of the register.


type

const char * type

The data type of the register.


bytes

size_t bytes

The number of bytes of the register.