diff --git a/doc/api/nxtdevices.rst b/doc/api/nxtdevices.rst index 335f1db..59ea248 100644 --- a/doc/api/nxtdevices.rst +++ b/doc/api/nxtdevices.rst @@ -34,3 +34,7 @@ NXT Touch Sensor NXT Light Sensor ^^^^^^^^^^^^^^^^ .. autoclass:: pybricks.nxtdevices.LightSensor + +NXT Color Sensor +^^^^^^^^^^^^^^^^ +.. autoclass:: pybricks.nxtdevices.ColorSensor diff --git a/pybricks/nxtdevices.py b/pybricks/nxtdevices.py index 376723e..091aee9 100644 --- a/pybricks/nxtdevices.py +++ b/pybricks/nxtdevices.py @@ -53,3 +53,47 @@ class LightSensor(): """ pass + + +class ColorSensor(): + """LEGO® MINDSTORMS® NXT Color Sensor.""" + + def __init__(self, port): + """ + + Arguments: + port (Port): Port to which the sensor is connected. + + """ + pass + + def color(self): + """Measure the color of a surface. + + :returns: + ``Color.BLACK``, ``Color.BLUE``, ``Color.GREEN``, ``Color.YELLOW``, + ``Color.RED``, ``Color.WHITE``, ``Color.BROWN`` or ``None``. + :rtype: :class:`Color <.parameters.Color>`, or ``None`` if no color is + detected. + + """ + 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. + + Returns: + :ref:`percentage`: Reflection, ranging from 0 (no reflection) to + 100 (high reflection). + + """ + pass