Initialises a :py:class:`~di_sensors.easy_line_follower.EasyLineFollower` object and then returns it. :param str port = "I2C": The only option for this parameter for the `Line Follower Sensor (red board)`_ is ``"I2C"`` and for the `Line Follower Sensor (black board)`_ it can also b
(self, port = "I2C")
| 1066 | return easysensors.ButtonSensor(port, self, use_mutex=self.use_mutex) |
| 1067 | |
| 1068 | def init_line_follower(self, port = "I2C"): |
| 1069 | """ |
| 1070 | Initialises a :py:class:`~di_sensors.easy_line_follower.EasyLineFollower` object and then returns it. |
| 1071 | |
| 1072 | :param str port = "I2C": The only option for this parameter for the `Line Follower Sensor (red board)`_ is ``"I2C"`` and for the `Line Follower Sensor (black board)`_ it can also be ``"AD1"``/``"AD2"``. The default value for this parameter is already set to ``"I2C"``. |
| 1073 | :returns: An instance of the :py:class:`~di_sensors.easy_line_follower.EasyLineFollower` class and with the port set to ``port``'s value. |
| 1074 | |
| 1075 | The ``"I2C"``, ``"AD1"`` and ``"AD2"`` ports are mapped to the following :ref:`hardware-ports-section`. |
| 1076 | |
| 1077 | .. tip:: |
| 1078 | |
| 1079 | | The sensor can be connected to any of the I2C ports. |
| 1080 | | You can connect different I2C devices simultaneously provided that: |
| 1081 | |
| 1082 | * The I2C devices have different addresses. |
| 1083 | * The I2C devices are recognizeable by the `GoPiGo3`_ platform. |
| 1084 | |
| 1085 | The ``use_mutex`` parameter of the :py:meth:`~easygopigo3.EasyGoPiGo3.__init__` constructor is passed down to the constructor of :py:class:`~di_sensors.easy_line_follower.EasyLineFollower` class. |
| 1086 | |
| 1087 | """ |
| 1088 | if di_sensors_available is False: |
| 1089 | raise ImportError("di_sensors library not found") |
| 1090 | |
| 1091 | lf = easy_line_follower.EasyLineFollower(port, use_mutex=self.use_mutex) |
| 1092 | if lf._sensor_id == 0: |
| 1093 | raise OSError("line follower is not reachable") |
| 1094 | |
| 1095 | return lf |
| 1096 | |
| 1097 | def init_servo(self, port = "SERVO1"): |
| 1098 | """ |
no outgoing calls
no test coverage detected