I2C access with Node.js
Find a file
Akihiko.KIgure 9c5bb9c006
Feature/lint (#33)
* lint add, lint error resolved

* lint add, lint warning resolved

* typescript down grade

* .eslint.js, packaage.json modfied.

* yarn.lock update

* L159 lint disabled
2021-03-28 17:31:45 +09:00
.github/workflows chore: update publish action 2021-02-06 17:14:47 +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 Feature/lint (#33) 2021-03-28 17:31:45 +09: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 Feature/lint (#33) 2021-03-28 17:31:45 +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