node-web-gpio/README.md

28 lines
444 B
Markdown
Raw Normal View History

2019-10-13 02:13:19 +09:00
# @notweb/gpio
GPIO access with Node.js
## Usage
```js
const { requestGPIOAccess } = require("@notweb/gpio");
async function main() {
const gpioAccess = await requestGPIOAccess();
const port = gpioAccess.ports.get(26);
await port.export("out");
for (;;) {
2019-10-13 02:32:03 +09:00
await port.write(value);
2019-10-13 02:13:19 +09:00
await new Promise(resolve => setTimeout(resolve, 1e3));
}
}
main();
```
## Document
[Web GPIO API](http://browserobo.github.io/WebGPIO)