Reads the numeric code received by the `Infrared Receiver`_. :return: The numeric code of the symbol that was pressed on the `Infrared Remote`_. :rtype: int The numeric code represents the index of the :py:attr:`~easysensors.Remote.keycodes` list. By access
(self)
| 1422 | raise |
| 1423 | |
| 1424 | def read(self): |
| 1425 | """ |
| 1426 | Reads the numeric code received by the `Infrared Receiver`_. |
| 1427 | |
| 1428 | :return: The numeric code of the symbol that was pressed on the `Infrared Remote`_. |
| 1429 | :rtype: int |
| 1430 | |
| 1431 | The numeric code represents the index of the :py:attr:`~easysensors.Remote.keycodes` list. |
| 1432 | By accessing the :py:attr:`~easysensors.Remote.keycodes` elements with the numeric code, you |
| 1433 | get the symbol that was pressed on the `Infrared Remote`_. |
| 1434 | |
| 1435 | For only getting the symbol that was pressed on the `Infrared Remote`_, please check the :py:meth:`~easysensors.Remote.get_remote_code` method. |
| 1436 | |
| 1437 | .. warning:: |
| 1438 | |
| 1439 | On :py:class:`~gopigo3.SensorError` exception: |
| 1440 | |
| 1441 | * ``"Invalid Reading"`` string is printed in the console. |
| 1442 | * The value of **-1** is returned. |
| 1443 | |
| 1444 | """ |
| 1445 | try: |
| 1446 | _ifMutexAcquire(self.use_mutex) |
| 1447 | val = self.gpg.get_grove_value(self.get_port_ID()) |
| 1448 | _ifMutexRelease(self.use_mutex) |
| 1449 | return val |
| 1450 | except gopigo3.SensorError as e: |
| 1451 | print("Invalid Reading") |
| 1452 | print(e) |
| 1453 | return -1 |
| 1454 | |
| 1455 | |
| 1456 | def get_remote_code(self): |
no test coverage detected