I2C access with Node.js
Find a file
2020-02-06 11:24:24 +09:00
.gitignore initial commit 2019-10-18 03:23:29 +09:00
index.d.ts resolved #1 2019-12-19 14:04:48 +09:00
index.js fix undefined length error 2020-02-06 11:18:33 +09:00
index.ts fix undefined length error 2020-02-06 11:18:33 +09:00
LICENSE Create LICENSE 2019-10-18 22:02:46 +09:00
package.json v1.1.2 2020-02-06 11:24:24 +09:00
README.md docs: use @chirimen/adt7410 2019-10-28 01:10:25 +09:00
tsconfig.json initial commit 2019-10-18 03:23:29 +09:00
yarn.lock update dependences 2020-02-06 11:23:35 +09:00

node-web-i2c

I2C access with Node.js

Usage

const { requestI2CAccess } = require("node-web-i2c");
const ADT7410 = require("@chirimen/adt7410");

const ADT7410_ADDR = 0x48;

async function main() {
  const i2cAccess = await requestI2CAccess();
  const port = i2cAccess.ports.get(1);
  const adt7410 = new ADT7410(port, ADT7410_ADDR);
  await adt7410.init();
  const temperature = await adt7410.read();
  console.log(`Temperature: ${temperature} ℃`);
}

main();

Document

Web I2C API