Servo lib docs (#1686)

* Servos extension ref docs

* fix param name
This commit is contained in:
Galen Nickel
2018-11-30 16:17:54 -08:00
committed by Peli de Halleux
parent 550f39e5b8
commit 48fcdc8013
4 changed files with 161 additions and 0 deletions

View File

@ -0,0 +1,32 @@
# run
Tell a continuous rotation servo to turn at a certain speed.
```sig
servos.P0.run(50)
```
A continuous rotation servo can turn both clockwise and counter-clockwise. They rotate at a speed from stopped to maximum rotation speed. Normally, a continuous rotation servo interprets an angle value as a speed value. But, by using ``||servos:run||`` though, you can use a speed percentage value to turn the servo from no speed to full speed (`0` to `100` percent). Also, for clockwise rotation, the speed value used is a positive number, speed > 0. If you want to turn the servo in the other direction (counter-clockwise), use a negative percentage value.
## Parameters
* **speed**: a [number](types/number) which is the percentage (`0` to `100`) of speed to turn the servo at. Use a positive value (speed > 0) to go clockwise and use a negative value to turn counter-clocwise.
## Example
Connect a servo to pin `P0`. Rotate the servo clockwise at `75` percent of full speed. Wait `3` seconds and then stop the servo.
```blocks
servos.P0.run(75)
basic.pause(3000)
servos.P0.run(0)
```
## See also
[set pulse](/reference/servos/set-pulse),
[set angle](/reference/servos/set-angle)
```package
servo
```