2.1.28, initiation update to PXT v5.28.24 (#54)

This commit is contained in:
Amerlander
2019-12-02 05:58:26 +01:00
committed by Peli de Halleux
parent 38a964516e
commit 5c114a0c57
1261 changed files with 50692 additions and 21604 deletions

View File

@@ -9,40 +9,41 @@ full speed in one direction, `180` specifies full speed in the other,
and approximately `90` specifies no movement.)
```sig
pins.servoWritePin(AnalogPin.P1, 180)
pins.servoWritePin(AnalogPin.P0, 180)
```
### Parameters
## Parameters
* ``name``: a [string](/reference/types/string) that specifies the pin name (`P0` through `P4`, or `P10`)
* ``value``: a [number](/reference/types/number) from `0` through `180`
* ``name``: a [string](/types/string) that specifies the pin name (`P0` through `P4`, or `P10`)
* ``value``: a [number](/types/number) from `0` through `180`
### Examples
## Examples
#### Setting the shaft angle to midpoint on a servo
### Setting the shaft angle to midpoint on a servo
```blocks
pins.servoWritePin(AnalogPin.P1, 90)
pins.servoWritePin(AnalogPin.P0, 90)
```
#### Controlling the shaft by using the tilt information of the accelerometer
### Controlling the shaft by using the tilt information of the accelerometer
```blocks
basic.forever(() => {
let millig = input.acceleration(Dimension.X)
// map accelerometer readings to angle
let angle = pins.map(millig, -1023, 1023, 0, 180)
pins.servoWritePin(AnalogPin.P1, angle)
pins.servoWritePin(AnalogPin.P0, angle)
})
```
#### Setting the full speed on a continuous servo
### Setting the full speed on a continuous servo
```blocks
pins.servoWritePin(AnalogPin.P1, 0)
pins.servoWritePin(AnalogPin.P0, 0)
```
### See also
## See also
[@boardname@ pins](/device/pins), [servo set pulse](/reference/pins/servo-set-pulse)
[Brief Guide to Servos](https://www.kitronik.co.uk/pdf/a-brief-guide-to-servos.pdf)