diff --git a/doc/api/nxtdevices.rst b/doc/api/nxtdevices.rst index b6eabaf..335f1db 100644 --- a/doc/api/nxtdevices.rst +++ b/doc/api/nxtdevices.rst @@ -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 diff --git a/pybricks/nxtdevices.py b/pybricks/nxtdevices.py index e5783db..376723e 100644 --- a/pybricks/nxtdevices.py +++ b/pybricks/nxtdevices.py @@ -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