This package has been deprecated

Author message:

This project has been renamed to node-web-i2c. Install using node-web-i2c instead.

@notweb/i2c
TypeScript icon, indicating that this package has built-in type declarations

0.0.1 • Public • Published

@notweb/i2c

I2C access with Node.js

Usage

const { requestI2CAccess } = require("@notweb/i2c");

const ADT7410_ADDR = 0x48;

async function main() {
  const i2cAccess = await requestI2CAccess();
  const port = gpioAccess.ports.get(1);
  const i2cSlave = await port.open(ADT7410_ADDR);
  const temperature =
    (((await i2cSlave.read8(0x00)) << 8) + (await i2cSlave.read8(0x01))) / 128;
  console.log(`Temperature: ${temperature} ℃`);
}

main();

Document

Web I2C API

/@notweb/i2c/

    Package Sidebar

    Install

    npm i @notweb/i2c

    Weekly Downloads

    0

    Version

    0.0.1

    License

    MIT

    Unpacked Size

    6.8 kB

    Total Files

    6

    Last publish

    Collaborators

    • kou029w