https://github.com/julianwowra/node-sht20
Library to work with a SHT20 chip via i2c
https://github.com/julianwowra/node-sht20
raspberry-pi sht20
Last synced: about 2 months ago
JSON representation
Library to work with a SHT20 chip via i2c
- Host: GitHub
- URL: https://github.com/julianwowra/node-sht20
- Owner: JulianWowra
- License: mit
- Created: 2021-12-05T10:46:31.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2025-01-05T11:00:41.000Z (over 1 year ago)
- Last Synced: 2025-02-10T05:33:32.664Z (over 1 year ago)
- Topics: raspberry-pi, sht20
- Language: TypeScript
- Homepage: https://julianwowra.github.io/node-sht20/
- Size: 72.3 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# node-SHT20
[](https://npmjs.org/package/node-sht20)
## Install
```sh
npm install node-sht20
```
```sh
yarn add node-sht20
```
## Usage
Usage in TypeScript (with ES Modules):
```typescript
import SHT20 from 'node-sht20';
const sensor = new SHT20({
bus: 1
});
async function start() {
const { temperature, humidity } = await sensor.read();
console.log(`Temperature: ${temperature.value} ${temperature.unit}`);
console.log(`Humidity: ${humidity.value} ${humidity.unit}`);
// Temperature in another unit
const degreeFahrenheit = temperature.toFahrenheit();
console.log(`Temperature: ${degreeFahrenheit.value} ${degreeFahrenheit.unit}`);
}
start();
```
Usage in JavaScript (with CommonJS):
```js
const nodeSHT20 = require('node-sht20');
const sensor = new nodeSHT20.SHT20({
bus: 1
});
async function start() {
const { temperature, humidity } = await sensor.read();
console.log(`Temperature: ${temperature.value} ${temperature.unit}`);
console.log(`Humidity: ${humidity.value} ${humidity.unit}`);
// Temperature in another unit
const degreeFahrenheit = temperature.toFahrenheit();
console.log(`Temperature: ${degreeFahrenheit.value} ${degreeFahrenheit.unit}`);
}
start();
```
---
## Author
👤 **KillerJulian **
- Github: [@KillerJulian](https://github.com/KillerJulian)
## 🤝 Contributing
Contributions, issues and feature requests are welcome!
Feel free to check [issues page](https://github.com/KillerJulian/node-sht20/issues). You can also take a look at the [contributing guide](https://github.com/KillerJulian/node-sht20/blob/master/CONTRIBUTING.md).