I2C access with Node.js
Find a file
2020-08-31 10:08:15 +09:00
.github/workflows create build task 2020-06-25 11:45:10 +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 build 2020-06-25 11:45:56 +09:00
index.ts format 2020-06-25 11:45:22 +09:00
LICENSE Create LICENSE 2019-10-18 22:02:46 +09:00
package.json Update dependency typescript to v4 2020-08-20 17:40:20 +00:00
README.md docs: use @chirimen/adt7410 2019-10-28 01:10:25 +09:00
renovate.json config renovate.json 2020-06-25 11:38:46 +09:00
tsconfig.json enable noFallthroughCasesInSwitch 2020-02-12 02:41:06 +09:00
yarn.lock Lock file maintenance 2020-08-31 00:30:17 +00: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