api/nxtdevices: add Light Sensor

This commit is contained in:
Laurens Valk
2020-01-14 20:13:23 +01:00
parent 19e4d3d36f
commit 7f3ac46558
2 changed files with 36 additions and 0 deletions
+4
View File
@@ -30,3 +30,7 @@ NXT Touch Sensor
from pybricks.nxtdevices import TouchSensor
from pybricks.parameters import Port
my_sensor = TouchSensor(Port.S1, verify_type=False)
NXT Light Sensor
^^^^^^^^^^^^^^^^
.. autoclass:: pybricks.nxtdevices.LightSensor
+32
View File
@@ -21,3 +21,35 @@ class TouchSensor():
"""
pass
class LightSensor():
"""LEGO® MINDSTORMS® NXT Color Sensor."""
def __init__(self, port):
"""
Arguments:
port (Port): Port to which the sensor is connected.
"""
pass
def ambient(self):
"""Measure the ambient light intensity.
Returns:
:ref:`percentage`: Ambient light intensity, ranging from 0 (dark)
to 100 (bright).
"""
pass
def reflection(self):
"""Measure the reflection of a surface using a red light.
Returns:
:ref:`percentage`: Reflection, ranging from 0 (no reflection) to
100 (high reflection).
"""
pass