Class Device
The ev3dev device base class
Declaration
class Device(object)
source linkDocumentation
Methods
▶ def __init__(self, class_name, name_pattern='*', name_exact=False, **kwargs) Spin through the Linux sysfs class for the device type and find a device that matches the provided name pattern and attributes (if any).
- 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: '*'.
- name_exact: when True, assume that the name_pattern provided is the
exact device name and use it directly.
- 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.
Example:
d = ev3dev.Device('tacho-motor', address='outA')
s = ev3dev.Device('lego-sensor', driver_name=['lego-ev3-us', 'lego-nxt-us'])
If there was no valid connected device, an error is thrown.
Overrides
This method is overriden in:
Overrides
This method is overriden in:
@property
def device_index(self)
Subclasses
Reexports