There is a function for listing all the attached motors, but nothing for listing the sensors. Based on list_motors, I came up with the following function that seems to list all the sensors:
def list_sensors(name_pattern=ev3.Sensor.SYSTEM_DEVICE_NAME_CONVENTION, **kwargs):
classpath = abspath(ev3.Device.DEVICE_ROOT_PATH + '/' + ev3.Sensor.SYSTEM_CLASS_NAME)
return (ev3.Sensor(name_pattern=name, name_exact=True)
for name in ev3.list_device_names(classpath, name_pattern, **kwargs))
Is this correct? If so, is it worthwhile adding to the library?
There is a function for listing all the attached motors, but nothing for listing the sensors. Based on list_motors, I came up with the following function that seems to list all the sensors:
Is this correct? If so, is it worthwhile adding to the library?