I2C access with Node.js
Find a file
2021-07-06 13:52:23 +09:00
.github/workflows use actions/setup-node cache 2021-07-06 13:52:23 +09:00
.eslintrc.js Feature/lint (#33) 2021-03-28 17:31:45 +09:00
.gitignore chore: use prepare 2021-02-06 17:30:53 +09:00
index.ts Feature/lint (#33) 2021-03-28 17:31:45 +09:00
LICENSE Create LICENSE 2019-10-18 22:02:46 +09:00
package.json 1.1.9 2021-04-19 18:08:53 +00:00
README.md docs: use @chirimen/adt7410 2019-10-28 01:10:25 +09:00
renovate.json chore: remove :maintainLockFilesWeekly 2021-02-06 17:35:05 +09:00
tsconfig.eslint.json Feature/lint (#33) 2021-03-28 17:31:45 +09:00
tsconfig.json enable noFallthroughCasesInSwitch 2020-02-12 02:41:06 +09:00
yarn.lock chore(deps): update typescript-eslint monorepo to ^4.22.0 2021-04-19 18:08:22 +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