obniz Parts Library

Keyestudio_TemperatureSensor

GitHub
Keyestudio_TemperatureSensor
Usable Devices :
obniz_board

Temperature Sensor - LM35DZ

Keyestudio temperature sensor.

wired(obniz, {vcc, gnd, output})

name type required default description
signal number(obniz Board io) yes   Signal pin outputs value of sensor(s pin of Keyestudio)
vcc number(obniz Board io) no   VCC for sensor(+ pin of Keyestudio)
gnd number(obniz Board io) no   GND for sensor(- pin of Keyestudio)
// Javascript Example
var tempsens = obniz.wired("Keyestudio_TemperatureSensor", {signal:0, vcc:1, gnd:2});

onchange

callback function for temperature change.
Unit of temp is Celsius.

// Javascript Example
var tempsens = obniz.wired("Keyestudio_TemperatureSensor", {signal:0, vcc:1, gnd:2});
tempsens.onchange = function(temp){
console.log(temp);
};

[await]getWait

get temperature change.
Unit of temp is Celsius.

// Javascript Example
var tempsens = obniz.wired("Keyestudio_TemperatureSensor", {signal:0, vcc:1, gnd:2});
var temp = await tempsens.getWait();
console.log(temp);

Supported from: obniz.js 3.5.0