Skip to content

Commit e015dc2

Browse files
committed
Add servo board example program
1 parent 98cec09 commit e015dc2

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

docs/source/api/servo-board.rst

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,26 @@ widths which in some cases will force the servo to try and turn past its
6060
internal end-stops. You should experiment and find what the actual limit
6161
of your servos are (it almost certainly won't be -1 and 1) and not
6262
drive them past that.
63+
64+
Example
65+
-------
66+
67+
.. code:: python
68+
69+
from sbot import *
70+
import time
71+
72+
r = Robot()
73+
servos = r.servo_board.servos
74+
75+
# Move all servos to the middle position
76+
for servo in servos:
77+
servo.position = 0
78+
79+
80+
# Slowly sweep servo 0 to the end and disengage it
81+
for percentage in range(100):
82+
position = percentage / 100
83+
servos[0].position = position
84+
time.sleep(0.05)
85+
servos[0].position = None

0 commit comments

Comments
 (0)