GPIO access with Node.js
Find a file
Akihiko.KIgure 13b6bc57b1
Feature/lint (#22)
* eslint package install

* scrupt add .

* warning resolved

* warning resolced

* error  Async function 'requestGPIOAccess' has no 'await' expression resolved

* Promise returned in function argument where a void return was expected resolved

* package-lock.json 削除

* script improve

* temporary commit

* L234 disabled eslint rules

* L159 lint disabled

* レビュー指摘事項反映
2021-03-28 17:31:23 +09:00
.github/workflows chore 2021-02-06 17:53:25 +09:00
.eslintrc.js Feature/lint (#22) 2021-03-28 17:31:23 +09:00
.gitignore build/publishプロセスの整理 2020-09-03 18:33:42 +09:00
index.ts Feature/lint (#22) 2021-03-28 17:31:23 +09:00
LICENSE create @notweb/gpio 2019-10-13 02:13:19 +09:00
package.json Feature/lint (#22) 2021-03-28 17:31:23 +09:00
README.md rename @notweb/gpio to node-web-gpio 2019-10-18 21:43:27 +09:00
renovate.json chore 2021-02-06 17:53:25 +09:00
tsconfig.eslint.json Feature/lint (#22) 2021-03-28 17:31:23 +09:00
tsconfig.json build/publishプロセスの整理 2020-09-03 18:33:42 +09:00
yarn.lock chore 2021-02-06 17:53:25 +09: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

Web GPIO API