Class PowerSupply
A generic interface to read data from the system's power_supply class. Uses the built-in legoev3-battery if none is specified.
Declaration
source linkDocumentation
Methods
▶ def __init__(self, address=None, name_pattern=SYSTEM_DEVICE_NAME_CONVENTION, ...) overrideinherited doc Spin through the Linux sysfs class for the device type and find a device that matches the provided name pattern and attributes (if any).
def __init__(
self,
address=None,
name_pattern=SYSTEM_DEVICE_NAME_CONVENTION,
name_exact=False,
**kwargs,
)
This method overrides ev3dev2.Device.__init__.
- 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.
@property
def max_voltage(self)
▷ def measured_amps(self) @property The measured current that the battery is supplying (in amps)
@property
def measured_amps(self)
▷ def measured_current(self) @property The measured current that the battery is supplying (in microamps)
@property
def measured_current(self)
▷ def measured_voltage(self) @property The measured voltage that the battery is supplying (in microvolts)
@property
def measured_voltage(self)
▷ def measured_volts(self) @property The measured voltage that the battery is supplying (in volts)
@property
def measured_volts(self)
@property
def min_voltage(self)
@property
def technology(self)
▷ def type(self) @property