Volatile Organic Compounds Sensor
The VolatileOrganicCompounds sensor class provides access to a sensor that detects the amount of volatile organic compounds suspended in air.
Constructor
Section titled “Constructor”VolatileOrganicCompounds(options)
Section titled “VolatileOrganicCompounds(options)”Creates a new VolatileOrganicCompounds object instance.
VolatileOrganicCompounds(options)Parameters
Section titled “Parameters”options
An object of properties used to construct the class.
sensor- The hardware connection definition.
interval(optional) - The sampling interval in milliseconds.
Instance Methods
Section titled “Instance Methods”sample()
Section titled “sample()”Returns a sample object containing the current VOC concentration data.
sample()Return Value
Section titled “Return Value”An object with the following property:
tvoc- A number that represents the sampled total volatile organic compounds in parts per billion (ppb).
Examples
Section titled “Examples”const sensor = new device.sensor.VolatileOrganicCompounds({ sensor: { io: device.io.I2C, address: 0x58 }});
const sample = sensor.sample();console.log(`VOC Level: ${sample.tvoc} ppb`);