node-web-gpio 1.1.22 → 1.1.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -19
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -4,31 +4,30 @@ GPIO access with Node.js
|
|
|
4
4
|
|
|
5
5
|
## Usage
|
|
6
6
|
|
|
7
|
+
```
|
|
8
|
+
$ npm i node-web-gpio
|
|
9
|
+
```
|
|
10
|
+
|
|
7
11
|
```js
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const sleep = promisify(setTimeout);
|
|
11
|
-
|
|
12
|
-
async function main() {
|
|
13
|
-
const gpioAccess = await requestGPIOAccess();
|
|
14
|
-
const port = gpioAccess.ports.get(26);
|
|
15
|
-
|
|
16
|
-
await port.export("out");
|
|
17
|
-
|
|
18
|
-
for (;;) {
|
|
19
|
-
await port.write(1);
|
|
20
|
-
await sleep(1000);
|
|
21
|
-
await port.write(0);
|
|
22
|
-
await sleep(1000);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
12
|
+
import { requestGPIOAccess } from "node-web-gpio";
|
|
13
|
+
import { setTimeout as sleep } from "node:timers/promises";
|
|
25
14
|
|
|
26
|
-
|
|
15
|
+
const gpioAccess = await requestGPIOAccess();
|
|
16
|
+
const port = gpioAccess.ports.get(26);
|
|
17
|
+
|
|
18
|
+
await port.export("out");
|
|
19
|
+
|
|
20
|
+
while (true) {
|
|
21
|
+
await port.write(1);
|
|
22
|
+
await sleep(1000);
|
|
23
|
+
await port.write(0);
|
|
24
|
+
await sleep(1000);
|
|
25
|
+
}
|
|
27
26
|
```
|
|
28
27
|
|
|
29
28
|
## Document
|
|
30
29
|
|
|
31
|
-
- [TSDoc](http://chirimen.org/node-web-gpio/)
|
|
30
|
+
- [TSDoc](http://www.chirimen.org/node-web-gpio/)
|
|
32
31
|
|
|
33
32
|
## Reference
|
|
34
33
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-web-gpio",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.24",
|
|
4
4
|
"description": "GPIO access with Node.js",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
"lint": "biome lint index.ts",
|
|
28
28
|
"prepare": "husky install && rm -rf dist && npm run build",
|
|
29
29
|
"precommit": "lint-staged",
|
|
30
|
+
"preversion": "npm run docs",
|
|
30
31
|
"docs": "npm run remove:docs && npm run typedoc -- --options typedoc.json --exclude '**/*.spec.ts' ./ README.md",
|
|
31
32
|
"typedoc": "typedoc",
|
|
32
33
|
"remove:docs": "rm -rf docs"
|