Temperature

Temperature

Read the Temperature values provided by the temperature sensor.

Members

Unit

Example
{
    Celcius: 0,
    Fahrenheit: 1,
    Kelvin: 2
}

Methods

(async) read(configOrUnitopt, channelsopt)

Parameters:
Name Type Attributes Default Description
configOrUnit ReadConfig | Unit <optional>

The read configuration OR the temperature unit to use

channels number <optional>
0

The number of channels to read (0 for all)

Examples
// Get a standard (directional) temperature reading
const {Temperature} = Agent.Peripherals;
const reading = await Temperature.read({unit: Temperature.Celcius});
// Returns [{channel: 0, value: 20}, {channel: 1, value: 23}];
// Get an ambient temperature reading
const {Temperature} = Agent.Peripherals;
const reading = await Temperature.read({ambient: true, unit: Temperature.Celcius});
// Returns [{channel: 0, value: 20}];
// Get two standard readings (alternate invocation)
const {Temperature} = Agent.Peripherals;
const reading = await Temperature.read(Temperature.Fahrenheit, 2);
// Returns [{channel: 0, value: 20}, {channel: 1, value: 23}];