mirror of
https://github.com/pybricks/pybricks-api.git
synced 2026-09-12 09:37:25 +00:00
api: standardize on method for light groups
Turn on all the lights at the specified brightness.
This commit is contained in:
+25
-7
@@ -472,15 +472,12 @@ class LightArray():
|
||||
"""
|
||||
pass
|
||||
|
||||
def on(self, *brightnesses):
|
||||
"""on(first_light, ..., last_light)
|
||||
|
||||
Set the brightness of each light.
|
||||
def on(self, brightness=100):
|
||||
"""Turn on all the lights at the specified brightness.
|
||||
|
||||
Arguments:
|
||||
brightnesses (:ref:`brightness`, ..., :ref:`brightness`):
|
||||
Brightness of each light. If you give just one value, all
|
||||
lights turn on with that same brightness.
|
||||
brightness (:ref:`brightness`):
|
||||
Brightness of the lights (*Default*: 100).
|
||||
"""
|
||||
pass
|
||||
|
||||
@@ -488,6 +485,17 @@ class LightArray():
|
||||
"""Turn off all the lights."""
|
||||
pass
|
||||
|
||||
def array(self, *brightnesses):
|
||||
"""array(first_light, ..., last_light)
|
||||
|
||||
Set the brightness of each light individually.
|
||||
|
||||
Arguments:
|
||||
brightnesses (:ref:`brightness`, ..., :ref:`brightness`):
|
||||
Brightness of each light.
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
class LightGrid():
|
||||
"""Control a rectangular grid of single-color lights."""
|
||||
@@ -522,6 +530,15 @@ class LightGrid():
|
||||
"""
|
||||
pass
|
||||
|
||||
def on(self, brightness=100):
|
||||
"""Turn on all the pixels at the specified brightness.
|
||||
|
||||
Arguments:
|
||||
brightness (:ref:`brightness`):
|
||||
Brightness of the lights (*Default*: 100).
|
||||
"""
|
||||
pass
|
||||
|
||||
def off(self):
|
||||
"""Turn off all the pixels."""
|
||||
pass
|
||||
@@ -601,6 +618,7 @@ light.rgb = ColorLight.rgb
|
||||
|
||||
lights = ModuleType('LightArray')
|
||||
lights.on = LightArray.on
|
||||
lights.array = LightArray.array
|
||||
lights.off = LightArray.off
|
||||
|
||||
buttons = ModuleType('KeyPad')
|
||||
|
||||
Reference in New Issue
Block a user