mirror of
https://github.com/pybricks/pybricks-api.git
synced 2026-09-12 01:24:17 +00:00
pybricks.pupdevices.ColorLightMatrix: add api and docs
This adds the SPIKE 3x3 Color Light Matrix to the API and docs.
This commit is contained in:
@@ -2,6 +2,11 @@
|
||||
|
||||
<!-- refer to https://keepachangelog.com/en/1.0.0/ for guidance -->
|
||||
|
||||
## Unreleased
|
||||
|
||||
### Added
|
||||
- Added `ColorLightMatrix` class.
|
||||
|
||||
## 1.6.0 - 2021-08-30
|
||||
|
||||
### Added
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 89 KiB |
@@ -0,0 +1,15 @@
|
||||
.. pybricks-requirements::
|
||||
|
||||
Color Light Matrix
|
||||
^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. figure:: ../../main/images/color_light_matrix.png
|
||||
:width: 35 %
|
||||
|
||||
.. autoclass:: pybricks.pupdevices.ColorLightMatrix
|
||||
:no-members:
|
||||
|
||||
.. automethod:: pybricks.pupdevices.ColorLightMatrix.on
|
||||
|
||||
.. automethod:: pybricks.pupdevices.ColorLightMatrix.off
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
colorsensor
|
||||
ultrasonicsensor
|
||||
forcesensor
|
||||
colorlightmatrix
|
||||
light
|
||||
remote
|
||||
|
||||
@@ -76,6 +77,12 @@
|
||||
:width: 35 %
|
||||
:target: forcesensor.html
|
||||
|
||||
.. pybricks-classlink:: ColorLightMatrix
|
||||
|
||||
.. figure:: ../../main/images/color_light_matrix.png
|
||||
:width: 35 %
|
||||
:target: color-light-matrix.html
|
||||
|
||||
.. pybricks-classlink:: Light
|
||||
|
||||
.. figure:: ../../main/images/light.png
|
||||
|
||||
@@ -377,6 +377,39 @@ class ForceSensor:
|
||||
pass
|
||||
|
||||
|
||||
class ColorLightMatrix:
|
||||
"""
|
||||
LEGO® SPIKE 3x3 Color Light Matrix.
|
||||
"""
|
||||
|
||||
def __init__(self, port):
|
||||
"""
|
||||
|
||||
Arguments:
|
||||
port (Port): Port to which the device is connected.
|
||||
|
||||
"""
|
||||
...
|
||||
|
||||
def on(self, colors):
|
||||
"""
|
||||
Turns the lights on.
|
||||
|
||||
Arguments:
|
||||
colors (Color or list):
|
||||
If a single :class:`.Color` is given, then all 9 lights are set
|
||||
to that color. If a list of colors is given, then each light is
|
||||
set to that color.
|
||||
"""
|
||||
...
|
||||
|
||||
def off(self):
|
||||
"""
|
||||
Turns all of the lights off.
|
||||
"""
|
||||
...
|
||||
|
||||
|
||||
class InfraredSensor:
|
||||
"""LEGO® Powered Up Infrared Sensor."""
|
||||
|
||||
|
||||
@@ -60,6 +60,11 @@ class ForceSensor:
|
||||
def pressed(self, force: int = 3) -> bool: ...
|
||||
def touched(self) -> bool: ...
|
||||
|
||||
class ColorLightMatrix:
|
||||
def __init__(self, port: Port) -> None: ...
|
||||
def on(self, color: Union[Color, List[Color]]) -> None: ...
|
||||
def off(self)-> None: ...
|
||||
|
||||
class InfraredSensor:
|
||||
def __init__(self, port: Port): ...
|
||||
def reflection(self) -> int: ...
|
||||
|
||||
Reference in New Issue
Block a user