rpi-io 2.0.0 → 2.0.1
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 +7 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -303,7 +303,7 @@ import {RIO, sleep, ctrlC, } from "rpi-io"
|
|
|
303
303
|
console.log("servo duty = 100%") // ~ 0.5 + (1.0 * (2.5 ms - 0.5 ms)) = 2.5 ms
|
|
304
304
|
await sleep(2000)
|
|
305
305
|
servo.pwmDuty(0)
|
|
306
|
-
|
|
306
|
+
console.log("servo duty = 0%") // ~ 0.5 + (0.0 * (2.5 ms - 0.5 ms)) = 0.5 ms
|
|
307
307
|
await sleep(2000)
|
|
308
308
|
servo.close()
|
|
309
309
|
console.log("servo closed")
|
|
@@ -372,7 +372,7 @@ node /your-project/node_modules/rpi-io/test/line-configuration.js
|
|
|
372
372
|
|
|
373
373
|
The **rpi-io** API is based on the class `RIO` with instance methods.
|
|
374
374
|
|
|
375
|
-
### RIO class
|
|
375
|
+
### RIO class and methods
|
|
376
376
|
|
|
377
377
|
#### constructor RIO(line, mode, opt)
|
|
378
378
|
To create instance according to parameters.
|
|
@@ -403,7 +403,7 @@ const myOutput = new RIO(17, "output")
|
|
|
403
403
|
period: 20000,
|
|
404
404
|
// pwm - dutyMin and dutyMax defines the duty cycle use range in µs
|
|
405
405
|
// especially for servo-motors (See their specs!).
|
|
406
|
-
dutyMin: 0
|
|
406
|
+
dutyMin: 0,
|
|
407
407
|
dutyMax: 20000
|
|
408
408
|
}
|
|
409
409
|
```
|
|
@@ -524,7 +524,7 @@ const servo = new RIO(13, "pwm", {
|
|
|
524
524
|
exportTime: 100,
|
|
525
525
|
period: 20000,
|
|
526
526
|
dutyMin: 500,
|
|
527
|
-
dutyMax: 2500)
|
|
527
|
+
dutyMax: 2500})
|
|
528
528
|
|
|
529
529
|
// duty cycle = 50% between dutyMin and dutyMax
|
|
530
530
|
servo.pwmDuty(50)
|
|
@@ -543,8 +543,8 @@ Function to close all instances
|
|
|
543
543
|
##### Example
|
|
544
544
|
```javascript
|
|
545
545
|
import {RIO} from "rpi-io"
|
|
546
|
-
const led = new RIO(
|
|
547
|
-
const btn = new RIO(
|
|
546
|
+
const led = new RIO(17, "output", {value: 0})
|
|
547
|
+
const btn = new RIO(18, "input")
|
|
548
548
|
RIO.closeAll()
|
|
549
549
|
// led and btn are closed
|
|
550
550
|
```
|
|
@@ -593,7 +593,7 @@ import {sleep, ctrlC} from "rpi-io"
|
|
|
593
593
|
ctrlC(() => {
|
|
594
594
|
console.log("displayed on script interrupt")
|
|
595
595
|
})
|
|
596
|
-
await sleep(
|
|
596
|
+
await sleep(10000)
|
|
597
597
|
console.log("displayed after 10s")
|
|
598
598
|
})()
|
|
599
599
|
```
|