Skip to content

Atmospheric Pressure Sensor

The AtmosphericPressure sensor class provides access to an atmospheric pressure sensor or barometer.

Creates a new AtmosphericPressure object instance.

AtmosphericPressure(options)

options

An object of properties used to construct the class.

sensor - The hardware connection definition.

interval (optional) - The sampling interval in milliseconds.

Returns a sample object containing the current pressure data.

sample()

An object with the following property:

pressure - A number that represents the sampled atmospheric pressure in Pascals.

const sensor = new device.sensor.AtmosphericPressure({
sensor: {
io: device.io.I2C,
address: 0x76
}
});
const sample = sensor.sample();
console.log(`Pressure: ${sample.pressure} Pa`);

Atmospheric Pressure