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:
David Lechner
2021-11-19 19:30:57 -06:00
parent 9d8531a85b
commit 2f574e8c03
6 changed files with 65 additions and 0 deletions
+5
View File
@@ -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

+15
View File
@@ -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
+7
View File
@@ -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
+33
View File
@@ -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."""
+5
View File
@@ -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: ...