UNPKG

aht20-sensor

Version:

A Node.js I2C module for the Adafruit AHT20 Humidity/Temperature Sensor.

14 lines (13 loc) 390 B
const { default: AHT20 } = require('../AHT20.js'); AHT20.open().then(async (sensor) => { try { const temp = await sensor.temperature(); const hum = await sensor.humidity(); console.log(temp, hum); } catch(err) { console.error("Failed to get temperature or humidity data."); } }).catch((err) => { console.error("Failed to open bus."); });