API reference¶
Device interfaces¶
Contents:
Other APIs¶
Each class in ev3dev module inherits from the base ev3dev2.Device
class.
-
class
ev3dev2.
Device
(class_name, name_pattern='*', name_exact=False, **kwargs)¶ The ev3dev device base class
-
ev3dev2.
list_device_names
(class_path, name_pattern, **kwargs)¶ This is a generator function that lists names of all devices matching the provided parameters.
- Parameters:
- class_path: class path of the device, a subdirectory of /sys/class.
- For example, ‘/sys/class/tacho-motor’.
- name_pattern: pattern that device name should match.
- For example, ‘sensor*’ or ‘motor*’. Default value: ‘*’.
- keyword arguments: used for matching the corresponding device
- attributes. For example, address=’outA’, or driver_name=[‘lego-ev3-us’, ‘lego-nxt-us’]. When argument value is a list, then a match against any entry of the list is enough.
-
ev3dev2.
list_devices
(class_name, name_pattern, **kwargs)¶ This is a generator function that takes same arguments as Device class and enumerates all devices present in the system that match the provided arguments.
- Parameters:
- class_name: class name of the device, a subdirectory of /sys/class.
- For example, ‘tacho-motor’.
- name_pattern: pattern that device name should match.
- For example, ‘sensor*’ or ‘motor*’. Default value: ‘*’.
- keyword arguments: used for matching the corresponding device
- attributes. For example, address=’outA’, or driver_name=[‘lego-ev3-us’, ‘lego-nxt-us’]. When argument value is a list, then a match against any entry of the list is enough.
-
ev3dev2.motor.
list_motors
(name_pattern='*', **kwargs)¶ This is a generator function that enumerates all tacho motors that match the provided arguments.
- Parameters:
- name_pattern: pattern that device name should match.
- For example, ‘motor*’. Default value: ‘*’.
- keyword arguments: used for matching the corresponding device
- attributes. For example, driver_name=’lego-ev3-l-motor’, or address=[‘outB’, ‘outC’]. When argument value is a list, then a match against any entry of the list is enough.
-
ev3dev2.sensor.
list_sensors
(name_pattern='sensor*', **kwargs)¶ This is a generator function that enumerates all sensors that match the provided arguments.
- Parameters:
- name_pattern: pattern that device name should match.
- For example, ‘sensor*’. Default value: ‘*’.
- keyword arguments: used for matching the corresponding device
- attributes. For example, driver_name=’lego-ev3-touch’, or address=[‘in1’, ‘in3’]. When argument value is a list, then a match against any entry of the list is enough.