Skip to content

Oxygen Sensor

The Oxygen sensor class provides access to an oxygen sensor.

Creates a new Oxygen object instance.

Oxygen(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 oxygen concentration data.

sample()

An object with the following property:

O - A number that represents the sampled oxygen in parts per million (ppm).

const sensor = new device.sensor.Oxygen({
sensor: {
io: device.io.I2C,
address: 0x35
}
});
const sample = sensor.sample();
console.log(`Oxygen Level: ${sample.O} ppm`);

Oxygen