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

Method __init__

Software/Python/easysensors.py:552–575  ·  view source on GitHub ↗

Constructor for initializing a :py:class:`~easysensors.LightSensor` object for the `Grove Light Sensor`_. :param str port = "AD1": Port to which we have the `Grove Light Sensor`_ connected to. :param easygopigo3.EasyGoPiGo3 gpg = None: :py:class:`~easygopigo3.EasyGoPiGo3` o

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

Source from the content-addressed store, hash-verified

550
551 """
552 def __init__(self, port="AD1", gpg=None, use_mutex = False):
553 """
554 Constructor for initializing a :py:class:`~easysensors.LightSensor` object for the `Grove Light Sensor`_.
555
556 :param str port = "AD1": Port to which we have the `Grove Light Sensor`_ connected to.
557 :param easygopigo3.EasyGoPiGo3 gpg = None: :py:class:`~easygopigo3.EasyGoPiGo3` object used for instantiating a :py:class:`~easysensors.LightSensor` object.
558 :param bool use_mutex = False: When using multiple threads/processes that access the same resource/device, mutexes should be enabled.
559 :raises TypeError: If the ``gpg`` parameter is not a :py:class:`~easygopigo3.EasyGoPiGo3` object.
560
561 The ``port`` parameter can take the following values:
562
563 * ``"AD1"`` - general purpose input/output port.
564 * ``"AD2"`` - general purpose input/output port.
565
566 The ports' locations can be seen in the following graphical representation: :ref:`hardware-ports-section`.
567
568 """
569 debug("LightSensor init")
570 self.set_descriptor("Light sensor")
571 try:
572 AnalogSensor.__init__(self, port, "INPUT", gpg, use_mutex)
573 except:
574 raise
575 self.set_pin(1)
576##########################
577
578

Callers

nothing calls this directly

Calls 4

set_descriptorMethod · 0.80
set_pinMethod · 0.80
debugFunction · 0.70
__init__Method · 0.45

Tested by

no test coverage detected