Atmospheric Pressure Sensor
The AtmosphericPressure sensor class provides access to an atmospheric pressure sensor or barometer.
Constructor
Section titled “Constructor”AtmosphericPressure(options)
Section titled “AtmosphericPressure(options)”Creates a new AtmosphericPressure object instance.
AtmosphericPressure(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 pressure data.
sample()Return Value
Section titled “Return Value”An object with the following property:
pressure- A number that represents the sampled atmospheric pressure in Pascals.
Examples
Section titled “Examples”const sensor = new device.sensor.AtmosphericPressure({ sensor: { io: device.io.I2C, address: 0x76 }});
const sample = sensor.sample();console.log(`Pressure: ${sample.pressure} Pa`);