From 5288a7e75d160f251eba9292c3bfbd1a2e947ae2 Mon Sep 17 00:00:00 2001 From: Laurens Valk Date: Tue, 25 Feb 2020 10:19:57 +0100 Subject: [PATCH] doc/iodevices/Ev3devSensor: add links and examples --- doc/api/iodevices_ev3.inc | 36 ++++++++++++++++++++++++++++++++++-- pybricks-projects | 2 +- 2 files changed, 35 insertions(+), 3 deletions(-) diff --git a/doc/api/iodevices_ev3.inc b/doc/api/iodevices_ev3.inc index bc43735..86e64eb 100644 --- a/doc/api/iodevices_ev3.inc +++ b/doc/api/iodevices_ev3.inc @@ -96,6 +96,38 @@ setting below. To learn more about compatible devices and what each mode does, visit the `ev3dev sensors`_ page. -.. _ev3dev sensors: http://docs.ev3dev.org/projects/lego-linux-drivers/en/ev3dev-stretch/sensors.html - .. autoclass:: pybricks.iodevices.Ev3devSensor + :no-members: + + .. autoattribute:: pybricks.iodevices.Ev3devSensor.sensor_index + :annotation: + + .. autoattribute:: pybricks.iodevices.Ev3devSensor.port_index + :annotation: + + .. automethod:: pybricks.iodevices.Ev3devSensor.read + +.. toggle-header:: + :header: **Show/hide example: Reading values with the Ev3devSensor class** + + **Example** + + In this example we use the LEGO MINDSTORMS EV3 Color Sensor with the raw + RGB mode. This gives uncalibrated red, green, and blue reflection values. + + .. literalinclude:: ../../pybricks-projects/snippets/ev3/ev3devsensor/main.py + +.. toggle-header:: + :header: **Show/hide example: Extending the Ev3devSensor class** + + **Example** + + This example shows how to extend the ``Ev3devSensor`` class by accessing + additional features found in the Linux system folder for this device. + + .. literalinclude:: ../../pybricks-projects/snippets/ev3/ev3devsensor/class_example.py + +.. _ev3dev sensors: http://docs.ev3dev.org/projects/lego-linux-drivers/en/ev3dev-stretch/sensors.html +.. _Mode name: http://docs.ev3dev.org/projects/lego-linux-drivers/en/ev3dev-stretch/sensor_data.html +.. _lego-sensor: http://docs.ev3dev.org/projects/lego-linux-drivers/en/ev3dev-stretch/sensors.html#the-lego-sensor-subsytem +.. _lego-port: http://docs.ev3dev.org/projects/lego-linux-drivers/en/ev3dev-stretch/ports.html#the-lego-port-subsystem diff --git a/pybricks-projects b/pybricks-projects index 561315a..297aa88 160000 --- a/pybricks-projects +++ b/pybricks-projects @@ -1 +1 @@ -Subproject commit 561315a105cf6e6d684a794f681286b5bab730d6 +Subproject commit 297aa884595eabb5319974b32bd4e8c42e1900c9