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

Method __init__

Software/Python/easysensors.py:619–642  ·  view source on GitHub ↗

Constructor for initializing a :py:class:`~easysensors.SoundSensor` object for the `Grove Sound Sensor`_. :param str port = "AD1": Port to which we have the `Grove Sound 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

617
618 """
619 def __init__(self, port="AD1", gpg=None, use_mutex=False):
620 """
621 Constructor for initializing a :py:class:`~easysensors.SoundSensor` object for the `Grove Sound Sensor`_.
622
623 :param str port = "AD1": Port to which we have the `Grove Sound Sensor`_ connected to.
624 :param easygopigo3.EasyGoPiGo3 gpg = None: :py:class:`~easygopigo3.EasyGoPiGo3` object used for instantiating a :py:class:`~easysensors.SoundSensor` object.
625 :param bool use_mutex = False: When using multiple threads/processes that access the same resource/device, mutexes should be enabled.
626 :raises TypeError: If the ``gpg`` parameter is not a :py:class:`~easygopigo3.EasyGoPiGo3` object.
627
628 The ``port`` parameter can take the following values:
629
630 * ``"AD1"`` - general purpose input/output port.
631 * ``"AD2"`` - general purpose input/output port.
632
633 The ports' locations can be seen in the following graphical representation: :ref:`hardware-ports-section`.
634
635 """
636 debug("Sound Sensor on port " + port)
637 self.set_descriptor("Sound sensor")
638 try:
639 AnalogSensor.__init__(self, port, "INPUT", gpg, use_mutex)
640 except:
641 raise
642 self.set_pin(1)
643
644
645##########################

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