From c02cc456f73988b61716a0f8a09e1d2c25ed23c2 Mon Sep 17 00:00:00 2001 From: Laurens Valk Date: Tue, 25 Feb 2020 10:19:04 +0100 Subject: [PATCH] api/iodevices/Ev3devSensor: add device index This makes it easy to find the sensor to access additional features through the ev3dev lego-sensor and lego-port classes. --- pybricks/iodevices.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/pybricks/iodevices.py b/pybricks/iodevices.py index 64acb28..82aea18 100644 --- a/pybricks/iodevices.py +++ b/pybricks/iodevices.py @@ -35,7 +35,13 @@ class LUMPDevice(): class Ev3devSensor(): - """Read values with an ev3dev-compatible sensor.""" + """Read values of an ev3dev-compatible sensor.""" + + sensor_index = 0 + """Index of the ev3dev sysfs `lego-sensor`_ class.""" + + port_index = 0 + """Index of the ev3dev sysfs `lego-port`_ class.""" def __init__(self, port): """ @@ -49,7 +55,7 @@ class Ev3devSensor(): """Read values at a given mode. Arguments: - mode (``str``): Mode name. + mode (``str``): `Mode name`_. Returns: ``tuple``: Values read from the sensor.