obniz Parts Library

DHT12

GitHub
DHT12
Usable Devices :
obniz_board
m5stickc
Found at :

Temperature Sensor - DHT12

Temperature and Humidity sensor DHT12

wired(obniz, {vcc , sda, scl, gnd} )

the address of DHT12 can be choosed from 0x44,0x45.

// Javascript Example
var sensor = obniz.wired("DHT12",{scl:26,sda:0});

[await] getAllDataWait()

Get temperature and Humidity.

// Javascript Example
let device = obniz.wired("DHT12",{scl:26,sda:0});

let data = await device.getAllDataWait();
console.log(data);

[await] getTempWait()

Get a temperature. Unit is Celsius.

// Javascript Example
let device = obniz.wired("DHT12",{scl:26,sda:0});

let data = await device.getTempWait();
console.log(data);

[await] getHumidWait()

Get a Humidity. Unit is Ratio(%).

// Javascript Example
let device = obniz.wired("DHT12",{scl:26,sda:0});

let data = await device.getHumidWait();
console.log(data);

Supported from: obniz.js 3.5.0