node-sht20
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

node-SHT20

NPM

Install

npm install node-sht20
yarn add node-sht20

Usage

Usage in TypeScript (with ES Modules):

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):

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 info@killerjulian.de

🤝 Contributing

Contributions, issues and feature requests are welcome!
Feel free to check issues page. You can also take a look at the contributing guide.

Readme

Keywords

Package Sidebar

Install

npm i node-sht20

Weekly Downloads

3

Version

1.0.3

License

MIT

Unpacked Size

25.4 kB

Total Files

26

Last publish

Collaborators

  • killerjulian