GPIO access with Node.js
Find a file
renovate[bot] a57c66de47
chore(deps): update actions/cache digest to 1bd1e32 (#83)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-01-01 03:31:15 +00:00
.github/workflows chore(deps): update actions/cache digest to 1bd1e32 (#83) 2025-01-01 03:31:15 +00:00
.husky husky, lint-staged, prettier 導入によるコミット時の自動フォーマット (#29) 2021-12-08 10:01:04 +09:00
docs generated docs 2024-10-04 23:28:47 +09:00
.eslintrc.yml husky, lint-staged, prettier 導入によるコミット時の自動フォーマット (#29) 2021-12-08 10:01:04 +09:00
.gitignore build/publishプロセスの整理 2020-09-03 18:33:42 +09:00
.lintstagedrc.yaml husky, lint-staged, prettier 導入によるコミット時の自動フォーマット (#29) 2021-12-08 10:01:04 +09:00
index.ts add 10 retry GPIO export polling 2024-10-06 15:23:40 +09:00
LICENSE create @notweb/gpio 2019-10-13 02:13:19 +09:00
package.json 1.1.7 2024-12-01 06:01:17 +00:00
README.md chore(README): README ドキュメント追加 (#49) 2023-02-17 16:05:54 +09:00
renovate.json set up monthly renovations 2024-10-04 22:59:20 +09:00
tsconfig.json build/publishプロセスの整理 2020-09-03 18:33:42 +09:00
typedoc.json TSDoc (#40) 2022-01-18 22:24:49 +09:00
yarn.lock chore(deps): update dependency husky to v9.1.7 (#82) 2024-12-01 06:00:57 +00:00

node-web-gpio

GPIO access with Node.js

Usage

const { requestGPIOAccess } = require("node-web-gpio");
const { promisify } = require("util");
const sleep = promisify(setTimeout);

async function main() {
  const gpioAccess = await requestGPIOAccess();
  const port = gpioAccess.ports.get(26);

  await port.export("out");

  for (;;) {
    await port.write(1);
    await sleep(1000);
    await port.write(0);
    await sleep(1000);
  }
}

main();

Document

Reference