Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 5 additions & 14 deletions ev3dev2/sensor/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,19 +62,7 @@
class Sensor(Device):
"""
The sensor class provides a uniform interface for using most of the
sensors available for the EV3. The various underlying device drivers will
create a `lego-sensor` device for interacting with the sensors.
Sensors are primarily controlled by setting the `mode` and monitored by
reading the `value<N>` attributes. Values can be converted to floating point
if needed by `value<N>` / 10.0 ^ `decimals`.
Since the name of the `sensor<N>` device node does not correspond to the port
that a sensor is plugged in to, you must look at the `address` attribute if
you need to know which port a sensor is plugged in to. However, if you don't
have more than one sensor of each type, you can just look for a matching
`driver_name`. Then it will not matter which port a sensor is plugged in to - your
program will still work.
sensors available for the EV3.
"""

SYSTEM_CLASS_NAME = 'lego-sensor'
Expand Down Expand Up @@ -286,7 +274,10 @@ def bin_data(self, fmt=None):
if fmt is None: return raw

return unpack(fmt, raw)


def _ensure_mode(self, mode):
if self.mode != mode:
self.mode = mode

def list_sensors(name_pattern=Sensor.SYSTEM_DEVICE_NAME_CONVENTION, **kwargs):
"""
Expand Down
Loading