Skip to content

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

License

Notifications You must be signed in to change notification settings

thomome/aht20-sensor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

aht20-sensor

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

Installation

npm install aht20-sensor

Example

const { default: AHT20 } = require('aht20-sensor');

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.");
});

Wiring

Wiring can be found here: https://cdn-learn.adafruit.com/downloads/pdf/adafruit-aht20.pdf

About

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

Resources

License

Stars

Watchers

Forks

Packages

No packages published