Class SCD41Client

java.lang.Object
dev.rablet.scd41.SCD41Client

public class SCD41Client extends Object
Client used to read data from an SCD41 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 id
      configName - the id to use for the configuration
      i2cBus - the i2c bus
      i2cDevice - the i2cDevice address
      Throws:
      IllegalArgumentException - if the provider does not exist
  • Method Details

    • getSerial

      public String getSerial() throws IOException
      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

      public SCD41Data getSCD41Data() throws IOException
      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

      public SCD41Data oneOffRead() throws IOException
      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