Package dev.rablet.scd41
Class SCD41Client
java.lang.Object
dev.rablet.scd41.SCD41Client
Client used to read data from an SCD41 sensor.
-
Constructor Summary
ConstructorsConstructorDescriptionCreates an instance of BME280 which can be used to get sensor reads.SCD41Client(String provider, String configName, Integer i2cBus, Integer i2cDevice) Creates an instance of BME280 which can be used to get sensor reads. -
Method Summary
Modifier and TypeMethodDescriptionReads data from the SCD41 sensor using the periodic read functionality of the sensor.Gets the SCD41 sensor serial.Requests a one-off read from the sensor.
-
Constructor Details
-
SCD41Client
public SCD41Client()Creates an instance of BME280 which can be used to get sensor reads. Uses the following defaults: * providerId = linuxfs-i2c * configName = SCD41 * i2cBus = 1 * i2cDevice = 0x62 -
SCD41Client
public SCD41Client(String provider, String configName, Integer i2cBus, Integer i2cDevice) throws IllegalArgumentException Creates an instance of BME280 which can be used to get sensor reads.- Parameters:
provider- the pi4j provider idconfigName- the id to use for the configurationi2cBus- the i2c busi2cDevice- the i2cDevice address- Throws:
IllegalArgumentException- if the provider does not exist
-
-
Method Details
-
getSerial
Gets the SCD41 sensor serial. This will stop any periodic reads since getting serial is not supported during periodic reads- Returns:
- String with the serial
- Throws:
IOException- if the serial could not be retrieved
-
getSCD41Data
Reads data from the SCD41 sensor using the periodic read functionality of the sensor. Once completed it will stop periodic reads from the sensor.- Returns:
- SCD41Data with the data from the sensor
- Throws:
IOException- if reading from the sensor failed
-
oneOffRead
Requests a one-off read from the sensor. This will stop any periodic sensor reads. NOTE: This appears to give inaccurate reads - use with caution- Returns:
- SCD41Data the data read from the sensor
- Throws:
IOException- if the sensor could not be read
-