Constructor for initializing a :py:class:`~easysensors.MotionSensor` object for the `Grove Motion Sensor`_. :param str port = "AD1": Port to which we have the `Grove Motion Sensor`_ connected to. :param easygopigo3.EasyGoPiGo3 gpg = None: :py:class:`~easygopigo3.EasyGoPiGo3
(self, port="AD1", gpg=None, use_mutex = False)
| 1262 | """ |
| 1263 | |
| 1264 | def __init__(self, port="AD1", gpg=None, use_mutex = False): |
| 1265 | """ |
| 1266 | Constructor for initializing a :py:class:`~easysensors.MotionSensor` object for the `Grove Motion Sensor`_. |
| 1267 | |
| 1268 | :param str port = "AD1": Port to which we have the `Grove Motion Sensor`_ connected to. |
| 1269 | :param easygopigo3.EasyGoPiGo3 gpg = None: :py:class:`~easygopigo3.EasyGoPiGo3` object used for instantiating a :py:class:`~easysensors.MotionSensor` object. |
| 1270 | :param bool use_mutex = False: When using multiple threads/processes that access the same resource/device, mutexes should be enabled. |
| 1271 | :raises TypeError: If the ``gpg`` parameter is not a :py:class:`~easygopigo3.EasyGoPiGo3` object. |
| 1272 | |
| 1273 | The ``port`` parameter can take the following values: |
| 1274 | |
| 1275 | * ``"AD1"`` - general purpose input/output port. |
| 1276 | * ``"AD2"`` - general purpose input/output port. |
| 1277 | |
| 1278 | The ports' locations can be seen in the following graphical representation: :ref:`hardware-ports-section`. |
| 1279 | |
| 1280 | """ |
| 1281 | try: |
| 1282 | self.set_descriptor("Motion Sensor") |
| 1283 | DigitalSensor.__init__(self, port, "DIGITAL_INPUT", gpg, use_mutex) |
| 1284 | self.set_pin(1) |
| 1285 | except: |
| 1286 | raise |
| 1287 | |
| 1288 | def motion_detected(self,port="AD1"): |
| 1289 | """ |
nothing calls this directly
no test coverage detected