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 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.
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. |
I2CDevice(TwoWire & bus, uint8_t deviceAddress)
Constructs an instance of the I2CDevice class.
-
bus
The I2C bus to use (default is Wire). -
deviceAddress
The address of the I2C device (default is DEFAULT_DEVICE_ADDRESS).
I2CDevice(uint8_t deviceAddress)
Constructs an I2CDevice object with the specified device address.
deviceAddress
The address of the I2C device.
bool connected()
Checks if the device is connected to the I2C bus.
true if the device is connected, false otherwise.
bool begin()
Initializes the I2C communication and checks if the device is connected.
true if the device is connected after initialization, false otherwise.
uint8_t deviceAddress() const
Get the I2C device address.
uint8_t The I2C device address.
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.
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. |
IndoorAirQualitySensor(TwoWire & bus, uint8_t deviceAddress)
Constructor for the IndoorAirQualitySensor class.
-
bus
The I2C bus to use. -
deviceAddress
The I2C address of the device.
IndoorAirQualitySensor(uint8_t deviceAddress)
Constructor for the IndoorAirQualitySensor class.
deviceAddress
The I2C address of the device.
bool sulfurOdor()
Get the sulfur odor-detected value (true or false)
The sulfur odor value.
float odorIntensity()
Get the odor intensity value.
The odor intensity value.
float ethanol()
Get the ethanol value.
The ethanol value.
float CO2()
Get the CO2 value in ppm.
The CO2 value.
float TVOC()
Get the TVOC value in (mg/m3)
The TVOC value.
float airQuality()
Get the air quality value. The common range is 0 to ~5.
The air quality value.
String airQualityInterpreted()
Get the interpreted air quality value. The possible values are "Very Good", "Good", "Medium", "Poor" and "Bad".
The interpreted air quality value.
float relativeAirQuality()
Get the relative air quality value in percent (0 - 100%).
The relative air quality value.
IndoorAirQualitySensorMode mode()
Get the mode of the IndoorAirQualitySensor.
The mode of the IndoorAirQualitySensor as an enum value.
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.
-
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.
True if the mode was set successfully, false otherwise.
String modeString()
Get the mode as a string. The possible values are "powerDown", "cleaning", "indoorAirQuality", "indoorAirQualityLowPower", "sulfur" and "unknown".
The mode as a string.
bool enabled()
Check if the sensor is enabled.
True if the sensor is enabled, false otherwise.
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.
-
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.
True if the the sensor was enabled successfully.
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.
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. |
NiclaSenseEnv(TwoWire & bus, uint8_t deviceAddress)
Constructs a new NiclaSenseEnv object.
-
bus
The I2C bus to use (default is Wire). -
deviceAddress
The I2C device address (default is 0x21).
NiclaSenseEnv(uint8_t deviceAddress)
Constructs a new NiclaSenseEnv object.
deviceAddress
The I2C address of the NiclaSenseEnv device.
~NiclaSenseEnv()
Destroy the Nicla Sense Env object. This will call the end() method while frees up allocated resources.
TemperatureHumiditySensor & temperatureHumiditySensor()
Returns the TemperatureHumiditySensor object to interact with the temperature and humidity sensor.
The TemperatureHumiditySensor object.
IndoorAirQualitySensor & indoorAirQualitySensor()
Returns the IndoorAirQualitySensor object to interact with the indoor air quality sensor.
A reference to the IndoorAirQualitySensor object.
OutdoorAirQualitySensor & outdoorAirQualitySensor()
Returns the OutdoorAirQualitySensor object to interact with the outdoor air quality sensor.
The OutdoorAirQualitySensor object.
RGBLED & rgbLED()
Returns the RGBLED object to interact with the RGB LED.
RGBLED& The reference to the RGBLED object.
OrangeLED & orangeLED()
Returns a reference to the OrangeLED object to interact with the orange LED.
OrangeLED& Reference to the OrangeLED object.
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.
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.
true if the settings were successfully stored, false otherwise.
String serialNumber()
Retrieves the serial number of the device.
The serial number as a String.
int productID()
Gets the numeric product ID.
The product ID.
int softwareRevision()
Get the software revision number.
The software revision number.
void reset()
Performs a soft reset of the device. Changes to the configuration that were not stored in flash will be lost.
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.
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.
true if the factory settings were successfully restored, false otherwise.
int UARTBaudRate()
Get the current baud rate of the UART communication. The supported values are: 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200.
int The UART Baud Rate.
bool setUARTBaudRate(int baudRate, bool persist)
Sets the baud rate for the UART communication.
-
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.
True if the baud rate was set successfully, false otherwise.
bool isUARTCSVOutputEnabled()
Checks if UART CSV output is enabled.
true if UART CSV output is enabled, false otherwise.
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.
-
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 viasetDebuggingEnabled
.
True if the CSV output mode was set successfully, false otherwise.
char CSVDelimiter()
Gets the CSV delimiter character. The default value is ','.
The CSV delimiter character.
bool setCSVDelimiter(char delimiter, bool persist)
Sets the CSV delimiter for parsing CSV data.
-
delimiter
The character to be used as the CSV delimiter. -
persist
If true, the change will be saved to flash memory.
True if the delimiter was set successfully, false otherwise.
bool isDebuggingEnabled()
Checks if debugging is enabled. When debugging mode is enabled, the board will send additional debug messages over UART.
true if debugging is enabled, false otherwise.
bool setDebuggingEnabled(bool enabled, bool persist)
Toggles the debugging mode. When debugging mode is enabled, the board will send additional debug messages over UART.
-
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 viasetUARTCSVOutputEnabled
will also be persisted.
True if the debugging mode was set successfully, false otherwise.
bool setDeviceAddress(int address, bool persist)
Sets the I2C address of the device.
-
address
The new I2C address. Valid values are 0 to 127. -
persist
If true, the change will be saved to flash memory.
True if the address was set successfully, false otherwise.
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.
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. |
OrangeLED(TwoWire & bus, uint8_t deviceAddress)
Constructs a OrangeLED object.
-
bus
The I2C bus to use (default is Wire). -
deviceAddress
The I2C device address (default is 0x21).
OrangeLED(uint8_t deviceAddress)
Constructs a OrangeLED object with the specified device address.
deviceAddress
The I2C address of the OrangeLED device.
uint8_t brightness()
Gets the brightness of the orange LED.
The brightness of the orange LED. Range is 0 to 255.
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.
-
brightness
: The brightness of the orange LED. Range is 0 to 255. -
persist
: If true, the brightness setting will be saved to flash memory.
True if the brightness was set successfully, false otherwise.
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.
True if the orange LED is used for error status, false otherwise.
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.
-
enabled
: Whether to enable or disable the orange LED error status. -
persist
: If true, the change will be saved to flash memory.
True if the mode was set successfully, false otherwise.
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.
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. |
OutdoorAirQualitySensor(TwoWire & bus, uint8_t deviceAddress)
Constructs an instance of the OutdoorAirQualitySensor class.
-
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(uint8_t deviceAddress)
Constructs an instance of the OutdoorAirQualitySensor class.
deviceAddress
The address of the sensor device.
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).
The air quality index as an integer.
String airQualityIndexInterpreted()
Gets the outdoor air quality index from the ZMOD4510 sensor and interprets it in terms of air quality.
The interpreted air quality index as a string. Possible values are: Good, Moderate, Unhealthy for Sensitive Groups, Unhealthy, Very Unhealthy, Hazardous.
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.
int The fast air quality index.
float NO2()
Get the NO2 value from the outdoor air quality sensor.
The NO2 concentration in ppb.
float O3()
Get the O3 value from the outdoor air quality sensor.
The O3 concentration in ppb.
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.
OutdoorAirQualitySensorMode The mode of the sensor.
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).
-
sensorMode
The mode to set for the sensor. -
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.
True if the mode was set successfully, false otherwise.
String modeString()
Gets the outdoor air quality sensor mode as a string.
The mode as string. Possible values are: powerDown, cleaning, outdoorAirQuality.
bool enabled()
Checks if the outdoor air quality sensor is enabled.
true if the sensor is enabled, false otherwise.
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.
-
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.
True if the enabled state was set successfully, false otherwise.
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.
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. |
RGBLED(TwoWire & bus, uint8_t deviceAddress)
Constructs an instance of the RGBLED class.
-
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(uint8_t deviceAddress)
Initializes an instance of the RGBLED class with the specified device address.
deviceAddress
The address of the RGB LED device.
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)
-
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.
True if the mode was set successfully, false otherwise.
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.
-
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.
True if the color was set successfully, false otherwise.
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.
-
color
The RGB color to set. -
persist
If true, the change will be saved to flash memory.
True if the color was set successfully, false otherwise.
LEDColor color()
Gets the current RGB color of the LED.
The current RGB color as a LEDColor object.
uint8_t brightness()
Get the brightness of the RGB LED (0-255)
The brightness value as a uint8_t.
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.
-
brightness
The brightness level to set (0-255). -
persist
If true, the change will be saved to flash memory.
True if the brightness was set successfully, false otherwise.
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.
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. |
TemperatureHumiditySensor(TwoWire & bus, uint8_t deviceAddress)
Constructs a TemperatureHumiditySensor object.
-
bus
The I2C bus to communicate with the sensor. Default is Wire. -
deviceAddress
The I2C address of the sensor. Default is 0x21.
TemperatureHumiditySensor(uint8_t deviceAddress)
Constructs a TemperatureHumiditySensor object with the specified device address.
deviceAddress
The I2C address of the temperature and humidity sensor.
float temperature()
Get the temperature value from the sensor in degrees Celsius.
float The temperature value.
float humidity()
Get the relative humidity value (Range 0-100%).
The humidity value as a float.
bool enabled()
Checks if the temperature and humidity sensor is enabled.
true if the sensor is enabled, false otherwise.
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.
-
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.
true if the operation was successful, false otherwise.
Represents a color with red, green, and blue components.
Members | Descriptions |
---|---|
red |
The red component of the color. |
green |
The green component of the color. |
blue |
The blue component of the color. |
uint8_t red
The red component of the color.
uint8_t green
The green component of the color.
uint8_t blue
The blue component of the color.
Structure representing information about a register.
Members | Descriptions |
---|---|
address |
The address of the register. |
type |
The data type of the register. |
bytes |
The number of bytes of the register. |
uint8_t address
The address of the register.
const char * type
The data type of the register.
size_t bytes
The number of bytes of the register.