mirror of
https://github.com/chirimen-oh/node-web-i2c.git
synced 2025-01-18 08:05:10 +00:00
I2C access with Node.js
623106c3bd
Bumps [minimatch](https://github.com/isaacs/minimatch) from 3.0.4 to 3.1.2. - [Release notes](https://github.com/isaacs/minimatch/releases) - [Commits](https://github.com/isaacs/minimatch/compare/v3.0.4...v3.1.2) --- updated-dependencies: - dependency-name: minimatch dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> |
||
---|---|---|
.github/workflows | ||
.husky | ||
docs | ||
.eslintrc.yml | ||
.gitignore | ||
.lintstagedrc.yaml | ||
index.ts | ||
LICENSE | ||
package.json | ||
README.md | ||
renovate.json | ||
tsconfig.eslint.json | ||
tsconfig.json | ||
typedoc.json | ||
yarn.lock |
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();