Humidity Sensor
The Humidity sensor class provides access to a humidity sensor (hygrometer).
Constructor
Section titled “Constructor”Humidity(options)
Section titled “Humidity(options)”Creates a new Humidity object instance.
Humidity(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 humidity data.
sample()Return Value
Section titled “Return Value”An object with the following property:
humidity- A number that represents the sampled relative humidity as a percentage.
Examples
Section titled “Examples”const sensor = new device.sensor.Humidity({ sensor: { io: device.io.I2C, address: 0x40 }});
const sample = sensor.sample();console.log(`Humidity: ${sample.humidity}%`);