GPIO access with Node.js
Find a file
2019-10-18 01:29:58 +09:00
.gitignore create @notweb/gpio 2019-10-13 02:13:19 +09:00
index.d.ts docs: GPIOPortMap 2019-10-16 00:27:50 +09:00
index.js refactor 2019-10-18 01:29:58 +09:00
index.ts refactor 2019-10-18 01:29:58 +09:00
LICENSE create @notweb/gpio 2019-10-13 02:13:19 +09:00
package.json 1.0.0 2019-10-16 00:30:25 +09:00
README.md docs: fix undefined variable 2019-10-15 20:39:11 +09:00
tsconfig.json create @notweb/gpio 2019-10-13 02:13:19 +09:00
yarn.lock create @notweb/gpio 2019-10-13 02:13:19 +09:00

@notweb/gpio

GPIO access with Node.js

Usage

const { requestGPIOAccess } = require("@notweb/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