mirror of
https://github.com/chirimen-oh/node-web-gpio.git
synced 2025-01-30 22:08:04 +00:00
GPIO access with Node.js
13b6bc57b1
* 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 * レビュー指摘事項反映 |
||
---|---|---|
.github/workflows | ||
.eslintrc.js | ||
.gitignore | ||
index.ts | ||
LICENSE | ||
package.json | ||
README.md | ||
renovate.json | ||
tsconfig.eslint.json | ||
tsconfig.json | ||
yarn.lock |
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();