MCPcopy Create free account
hub / github.com/DexterInd/GoPiGo3 / __init__

Method __init__

Software/Python/easysensors.py:1511–1532  ·  view source on GitHub ↗

Constructor for instantiating a :py:class:`~easysensors.Servo` object for a (or multiple) `servo`_ (servos). :param str port = "SERVO1": The port to which we have connected the `servo`_. :param easygopigo3.EasyGoPiGo3 gpg = None: :py:class:`~easygopigo3.EasyGoPiGo3` object

(self, port="SERVO1", gpg=None, use_mutex=False)

Source from the content-addressed store, hash-verified

1509 """
1510
1511 def __init__(self, port="SERVO1", gpg=None, use_mutex=False):
1512 """
1513 Constructor for instantiating a :py:class:`~easysensors.Servo` object for a (or multiple) `servo`_ (servos).
1514
1515 :param str port = "SERVO1": The port to which we have connected the `servo`_.
1516 :param easygopigo3.EasyGoPiGo3 gpg = None: :py:class:`~easygopigo3.EasyGoPiGo3` object that we need for instantiation.
1517 :param bool use_mutex = False: When using multiple threads/processes that access the same resource/device, mutexes should be enabled.
1518 :raises TypeError: If the ``gpg`` parameter is not a :py:class:`~easygopigo3.EasyGoPiGo3` object.
1519
1520 The available ports that can be used for a `servo`_ are:
1521
1522 * ``"SERVO1"`` - servo controller port.
1523 * ``"SERVO2"`` - servo controller port.
1524
1525 To see where these 2 ports are located, please take a look at the following graphical representation: :ref:`hardware-ports-section`.
1526
1527 """
1528 try:
1529 self.set_descriptor("GoPiGo3 Servo")
1530 Sensor.__init__(self, port, "OUTPUT", gpg, use_mutex)
1531 except:
1532 raise
1533
1534 def rotate_servo(self, servo_position):
1535 """

Callers

nothing calls this directly

Calls 2

set_descriptorMethod · 0.80
__init__Method · 0.45

Tested by

no test coverage detected