Edited advanced topic

This commit is contained in:
Ron Hale-Evans 2016-06-30 12:43:42 -07:00
parent 92c63b615a
commit 36e6570296
1 changed files with 10 additions and 6 deletions

View File

@ -1,6 +1,7 @@
# Servo Set Pulse
Configures the pin [pin](/device/pins) (``P0``, ``P1`` or ``P2``) as an analog/PWM output if it isn't already, configures the period to be 20ms, and sets the pulse width, based on the value it is given.
Configure the specified pin as analog output, set the period to 20
ms, and set the pulse width to the specified value.
```sig
pins.servoSetPulse(AnalogPin.P1, 1500)
@ -8,12 +9,12 @@ pins.servoSetPulse(AnalogPin.P1, 1500)
### Parameters
* `name` - [String](/reference/types/string); the pin name ("P0", "P1", or "P2")
* `micros` - a [Number](/reference/types/number) representing the micro-seconds of the pulse width.
* `pin`: a [string](/reference/types/string) that specifies the pin to configure (`P0` through `P4`, or `P10`)
* `μs`: a [number](/reference/types/number) that specifies the analog period in microseconds.
### Example
The following code sets the servo pulse to ``1000`` micro seconds.
The following code sets the servo pulse to `1000` microseconds.
```blocks
pins.servoSetPulse(AnalogPin.P0, 1000)
@ -21,5 +22,8 @@ pins.servoSetPulse(AnalogPin.P0, 1000)
### See also
[BBC micro:bit pins](/device/pins), [on pin pressed](/reference/input/on-pin-pressed), [analog read pin](/reference/pins/analog-read-pin), [digital read pin](/reference/pins/digital-read-pin), [digital write pin](/reference/pins/digital-write-pin)
[BBC micro:bit pins](/device/pins),
[on pin pressed](/reference/input/on-pin-pressed),
[analog read pin](/reference/pins/analog-read-pin),
[digital read pin](/reference/pins/digital-read-pin),
[digital write pin](/reference/pins/digital-write-pin)