Temperature

Retrieves the temperature of the device.

Note: This measures the temperature of the internal sensor, not the ambient air temperature. Due to power consumption and heat dissipation, the recorded value will typically be higher than the actual room temperature.

obniz.motion.start(temperature, accel, recognition)

Initializes the motion module.
You can specify the sensitivity via the arguments. Sensitivity is defined from 0.0 to 1.0. A value of 1.0 will trigger a notification for even the slightest change in temperature.

Once start() is called, onTemperatureUpdate will be triggered at least once.

The first argument is used for temperature detection sensitivity.

// Javascript Example
  obniz.motion.onTemperatureUpdate = ((temp) => {
    console.log(`Temp: ${temp} degree`);
  });
  // Start with 0.99 temperature sensitivity
  obniz.motion.start(0.99, 0, 0);

obniz.motion.onTemperatureUpdate

This callback is triggered whenever a temperature change is detected.
The temperature value is provided in degrees Celsius.

// Javascript Example
  obniz.motion.onTemperatureUpdate = ((temp) => {
    console.log(`Temp: ${temp} degree`);
  });
  obniz.motion.start(0.99, 0, 0);

obniz.motion.getTemperatureWait()

Performs a single measurement and retrieves the value, rather than continuous monitoring.

// Javascript Example
  const temp = await obniz.motion.getTemperatureWait();
  console.log(`Temp: ${temp} degree`);