diff --git a/pybricks/_common.py b/pybricks/_common.py index 9ea671f..6fb9593 100644 --- a/pybricks/_common.py +++ b/pybricks/_common.py @@ -435,20 +435,22 @@ class ColorLight: class LightArray: """Control an array of single-color lights.""" - def __init__(self, lights): + def __init__(self, n): """Initializes the light array. Arguments: - lights (int): Number of lights + n (int): Number of lights """ pass - def on(self, brightness=100): - """Turns on all the lights at the specified brightness. + def on(self, *brightness): + """Turns on the lights at the specified brightness. Arguments: - brightness (:ref:`brightness`): - Brightness of the lights. + *brightness (:ref:`brightness`, :ref:`brightness`, ...): + Brightness of each light. If you give only one value, it is + applied to all lights at once. + """ pass @@ -456,17 +458,6 @@ class LightArray: """Turns off all the lights.""" pass - def array(self, *brightnesses): - """array(first_light, ..., last_light) - - Sets the brightness of each light individually. - - Arguments: - brightness (:ref:`brightness`, ..., :ref:`brightness`): - Brightness of each light. - """ - pass - class LightGrid: """Control a rectangular grid of single-color lights.""" diff --git a/pybricks/pupdevices.py b/pybricks/pupdevices.py index 6a48387..979850d 100644 --- a/pybricks/pupdevices.py +++ b/pybricks/pupdevices.py @@ -4,7 +4,8 @@ """LEGO® Powered Up motor, sensors, and lights.""" from ._common import (KeyPad as _KeyPad, Accelerometer as _Accelerometer, - ColorLight as _ColorLight, Motor as _Motor) + ColorLight as _ColorLight, Motor as _Motor, + LightArray as _LightArray) class Motor(_Motor): @@ -135,3 +136,9 @@ class ColorDistanceSensor: Choose ``None`` if you don't want to press any button. """ + + +class ColorSensor: + """LEGO® SPIKE Color Sensor.""" + + lights = _LightArray(3)