mirror of
https://github.com/pybricks/pybricks-api.git
synced 2026-09-15 11:04:55 +00:00
api: add PrimeHub
This commit is contained in:
@@ -19,6 +19,14 @@ Technic Hub (Technic)
|
||||
|
||||
.. include:: hubs_technichub.inc
|
||||
|
||||
Prime Hub (SPIKE)
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. figure:: ../api/images/primehub.png
|
||||
:height: 15 em
|
||||
|
||||
.. include:: hubs_primehub.inc
|
||||
|
||||
Move Hub (BOOST)
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
.. autoclass:: pybricks.hubs.PrimeHub
|
||||
:no-members:
|
||||
|
||||
.. rubric:: Using the hub status light
|
||||
|
||||
.. toggle-header::
|
||||
:header: **Show/hide examples**
|
||||
|
||||
**Example 1: Turning the light on and off**
|
||||
|
||||
.. literalinclude::
|
||||
../../pybricks-projects/snippets/pup/hub_primehub/light_off.py
|
||||
|
||||
**Example 2: Changing brightness and using custom colors**
|
||||
|
||||
.. literalinclude::
|
||||
../../pybricks-projects/snippets/pup/hub_primehub/light_hsv.py
|
||||
|
||||
**Example 3: Making the light blink**
|
||||
|
||||
.. literalinclude::
|
||||
../../pybricks-projects/snippets/pup/hub_primehub/light_blink.py
|
||||
|
||||
**Example 4: Creating light animations**
|
||||
|
||||
.. literalinclude::
|
||||
../../pybricks-projects/snippets/pup/hub_primehub/light_animate.py
|
||||
|
||||
.. automethod:: pybricks.hubs::PrimeHub.light.on
|
||||
|
||||
.. automethod:: pybricks.hubs::PrimeHub.light.off
|
||||
|
||||
.. automethod:: pybricks.hubs::PrimeHub.light.blink
|
||||
|
||||
.. automethod:: pybricks.hubs::PrimeHub.light.animate
|
||||
|
||||
.. rubric:: Using the battery
|
||||
|
||||
.. automethod:: pybricks.hubs::PrimeHub.battery.voltage
|
||||
|
||||
.. automethod:: pybricks.hubs::PrimeHub.battery.current
|
||||
|
||||
@@ -32,3 +32,9 @@ class TechnicHub:
|
||||
"""LEGO® Technic Hub."""
|
||||
battery = _Battery()
|
||||
light = _ColorLight()
|
||||
|
||||
|
||||
class PrimeHub:
|
||||
"""LEGO® SPIKE Prime Hub."""
|
||||
battery = _Battery()
|
||||
light = _ColorLight()
|
||||
|
||||
Reference in New Issue
Block a user