summaryrefslogtreecommitdiffstatshomepage
path: root/docs/library/pyb.Servo.rst
blob: d75ed8a2d75f26646d30d8dd5e859946b778a088 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
class Servo --- 3-wire hobby servo driver
=========================================

Servo controls standard hobby servos with 3-wires (ground, power, signal).


Constructors
------------

.. class:: pyb.Servo(id)

   Create a servo object.  ``id`` is 1-4.


Methods
-------

.. method:: servo.angle([angle, time=0])

   Get or set the angle of the servo.
   
     - ``angle`` is the angle to move to in degrees.
     - ``time`` is the number of milliseconds to take to get to the specified angle.

.. method:: servo.calibration([pulse_min, pulse_max, pulse_centre, [pulse_angle_90, pulse_speed_100]])

   Get or set the calibration of the servo timing.

.. method:: servo.pulse_width([value])

   Get or set the pulse width in milliseconds.

.. method:: servo.speed([speed, time=0])

   Get or set the speed of a continuous rotation servo.
   
     - ``speed`` is the speed to move to change to, between -100 and 100.
     - ``time`` is the number of milliseconds to take to get to the specified speed.