obniz Parts Library

DHT20

GitHub
DHT20
Usable Devices :
obniz_board
m5stickc

Temperature Sensor - DHT20

Temperature and Humidity sensor DHT20

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

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

// Javascript Example
var sensor = obniz.wired("DHT20",{vcc:0, sda:1, gnd:2,  scl:3});

[await] getAllDataWait()

Get temperature and Humidity.

// Javascript Example
let device = obniz.wired("DHT20",{vcc:0, sda:1, gnd:2,  scl:3});

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

[await] getTemperatureWait()

Get a temperature. Unit is Celsius.

// Javascript Example
let device = obniz.wired("DHT20",{vcc:0, sda:1, gnd:2,  scl:3});

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

[await] getHumidityWait()

Get a Humidity. Unit is Ratio(%).

// Javascript Example
let device = obniz.wired("DHT20",{vcc:0, sda:1, gnd:2,  scl:3});

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

Supported from: obniz.js 3.31.0