Constructor for initializing a :py:class:`~easysensors.UltraSonicSensor` object for the `Grove Ultrasonic Sensor`_. :param str port = "AD1": Port to which we have the `Grove Ultrasonic Sensor`_ connected to. :param easygopigo3.EasyGoPiGo3 gpg = None: :py:class:`~easygopigo3
(self, port="AD1", gpg=None, use_mutex = False)
| 756 | """ |
| 757 | |
| 758 | def __init__(self, port="AD1", gpg=None, use_mutex = False): |
| 759 | """ |
| 760 | Constructor for initializing a :py:class:`~easysensors.UltraSonicSensor` object for the `Grove Ultrasonic Sensor`_. |
| 761 | |
| 762 | :param str port = "AD1": Port to which we have the `Grove Ultrasonic Sensor`_ connected to. |
| 763 | :param easygopigo3.EasyGoPiGo3 gpg = None: :py:class:`~easygopigo3.EasyGoPiGo3` object used for instantiating a :py:class:`~easysensors.UltraSonicSensor` object. |
| 764 | :param bool use_mutex = False: When using multiple threads/processes that access the same resource/device, mutexes should be enabled. |
| 765 | :raises TypeError: If the ``gpg`` parameter is not a :py:class:`~easygopigo3.EasyGoPiGo3` object. |
| 766 | |
| 767 | The ``port`` parameter can take the following values: |
| 768 | |
| 769 | * ``"AD1"`` - general purpose input/output port. |
| 770 | * ``"AD2"`` - general purpose input/output port. |
| 771 | |
| 772 | The ports' locations can be seen in the following graphical representation: :ref:`hardware-ports-section`. |
| 773 | |
| 774 | """ |
| 775 | |
| 776 | try: |
| 777 | debug("Ultrasonic Sensor on port " + port) |
| 778 | AnalogSensor.__init__(self, port, "US", gpg, use_mutex) |
| 779 | self.set_descriptor("Ultrasonic sensor") |
| 780 | self.safe_distance = 500 |
| 781 | self.set_pin(1) |
| 782 | except: |
| 783 | raise |
| 784 | |
| 785 | |
| 786 | def is_too_close(self): |
nothing calls this directly
no test coverage detected