mirror of
https://github.com/pybricks/pybricks-api.git
synced 2026-09-11 17:14:41 +00:00
doc/hubs: move examples to dedicated sections
Now that each hub is on its own page, we no longer need to collapse snippets to reduce page size. Now they can just all be at the bottom of the page. This also gives each a dedicated link which is easier when giving support.
This commit is contained in:
+26
-23
@@ -9,29 +9,6 @@ City Hub
|
||||
|
||||
.. rubric:: Using the hub status light
|
||||
|
||||
.. toggle-header::
|
||||
:header: **Show/hide examples**
|
||||
|
||||
**Example 1: Turning the light on and off**
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_cityhub/light_off.py
|
||||
|
||||
**Example 2: Changing brightness and using custom colors**
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_cityhub/light_hsv.py
|
||||
|
||||
**Example 3: Making the light blink**
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_cityhub/light_blink.py
|
||||
|
||||
**Example 4: Creating light animations**
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_cityhub/light_animate.py
|
||||
|
||||
.. automethod:: pybricks.hubs::CityHub.light.on
|
||||
|
||||
.. automethod:: pybricks.hubs::CityHub.light.off
|
||||
@@ -46,3 +23,29 @@ City Hub
|
||||
|
||||
.. automethod:: pybricks.hubs::CityHub.battery.current
|
||||
|
||||
Status light examples
|
||||
---------------------
|
||||
|
||||
Turning the light on and off
|
||||
****************************
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_cityhub/light_off.py
|
||||
|
||||
Changing brightness and using custom colors
|
||||
*******************************************
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_cityhub/light_hsv.py
|
||||
|
||||
Making the light blink
|
||||
**********************
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_cityhub/light_blink.py
|
||||
|
||||
Creating light animations
|
||||
*************************
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_cityhub/light_animate.py
|
||||
|
||||
+38
-47
@@ -15,14 +15,6 @@ MINDSTORMS EV3 Brick
|
||||
|
||||
.. automethod:: pybricks.hubs::EV3Brick.light.on
|
||||
|
||||
.. toggle-header::
|
||||
:header: **Show/hide example**
|
||||
|
||||
**Example: Turn the light on and change the color.**
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/ev3/light_color/main.py
|
||||
|
||||
.. automethod:: pybricks.hubs::EV3Brick.light.off
|
||||
|
||||
.. rubric:: Using the speaker
|
||||
@@ -145,67 +137,66 @@ MINDSTORMS EV3 Brick
|
||||
|
||||
.. automethod:: pybricks.hubs::EV3Brick.screen.print
|
||||
|
||||
.. toggle-header::
|
||||
:header: **Show/hide example**
|
||||
|
||||
**Example: Say hello... in several ways.**
|
||||
|
||||
.. raw:: latex
|
||||
|
||||
\begin{CJK}{UTF8}{gbsn}
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/ev3/screen_print/main.py
|
||||
|
||||
.. raw:: latex
|
||||
|
||||
\end{CJK}
|
||||
|
||||
.. automethod:: pybricks.hubs::EV3Brick.screen.set_font
|
||||
|
||||
**Example:** See example in :meth:`print`.
|
||||
|
||||
.. automethod:: pybricks.hubs::EV3Brick.screen.load_image
|
||||
|
||||
.. toggle-header::
|
||||
:header: **Show/hide example**
|
||||
|
||||
**Example: Show an image on the screen.**
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/ev3/screen_image/main.py
|
||||
|
||||
.. automethod:: pybricks.hubs::EV3Brick.screen.draw_image
|
||||
|
||||
.. automethod:: pybricks.hubs::EV3Brick.screen.draw_pixel
|
||||
|
||||
.. automethod:: pybricks.hubs::EV3Brick.screen.draw_line
|
||||
|
||||
.. toggle-header::
|
||||
:header: **Show/hide example**
|
||||
|
||||
**Example: Draw some shapes on the screen.**
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/ev3/screen_draw/main.py
|
||||
|
||||
.. automethod:: pybricks.hubs::EV3Brick.screen.draw_box
|
||||
|
||||
**Example:** See example in :meth:`draw_line`.
|
||||
|
||||
.. automethod:: pybricks.hubs::EV3Brick.screen.draw_circle
|
||||
|
||||
**Example:** See example in :meth:`draw_line`.
|
||||
|
||||
.. autoattribute:: pybricks.hubs::EV3Brick.screen.width
|
||||
|
||||
.. autoattribute:: pybricks.hubs::EV3Brick.screen.height
|
||||
|
||||
.. automethod:: pybricks.hubs::EV3Brick.screen.save
|
||||
|
||||
|
||||
.. rubric:: Using the battery
|
||||
|
||||
.. automethod:: pybricks.hubs::EV3Brick.battery.voltage
|
||||
|
||||
.. automethod:: pybricks.hubs::EV3Brick.battery.current
|
||||
|
||||
Status light examples
|
||||
---------------------
|
||||
|
||||
Turn the light on and change the color
|
||||
**************************************
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/ev3/light_color/main.py
|
||||
|
||||
Screen examples
|
||||
---------------------
|
||||
|
||||
Show an image on the screen
|
||||
***************************
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/ev3/screen_image/main.py
|
||||
|
||||
Drawing shapes on the screen
|
||||
****************************
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/ev3/screen_draw/main.py
|
||||
|
||||
Using different fonts
|
||||
*********************
|
||||
|
||||
.. raw:: latex
|
||||
|
||||
\begin{CJK}{UTF8}{gbsn}
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/ev3/screen_print/main.py
|
||||
|
||||
.. raw:: latex
|
||||
|
||||
\end{CJK}
|
||||
|
||||
@@ -16,29 +16,6 @@ MINDSTORMS Inventor Hub
|
||||
.. figure:: ../../api/images/primehub_light_label.png
|
||||
:width: 22 em
|
||||
|
||||
.. toggle-header::
|
||||
:header: **Show/hide examples**
|
||||
|
||||
**Example 1: Turning the light on and off**
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_inventorhub/light_off.py
|
||||
|
||||
**Example 2: Changing brightness and using custom colors**
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_inventorhub/light_hsv.py
|
||||
|
||||
**Example 3: Making the light blink**
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_inventorhub/light_blink.py
|
||||
|
||||
**Example 4: Creating light animations**
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_inventorhub/light_animate.py
|
||||
|
||||
.. automethod:: pybricks.hubs::InventorHub.light.on
|
||||
|
||||
.. automethod:: pybricks.hubs::InventorHub.light.off
|
||||
@@ -52,49 +29,6 @@ MINDSTORMS Inventor Hub
|
||||
.. figure:: ../../api/images/primehub_display_label.png
|
||||
:width: 22 em
|
||||
|
||||
.. toggle-header::
|
||||
:header: **Show/hide examples**
|
||||
|
||||
**Example 1: Displaying images**
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_inventorhub/display_image.py
|
||||
|
||||
**Example 2: Displaying numbers**
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_inventorhub/display_number.py
|
||||
|
||||
**Example 3: Displaying text**
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_inventorhub/display_text.py
|
||||
|
||||
**Example 4: Displaying individual pixels**
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_inventorhub/display_pixel.py
|
||||
|
||||
**Example 5: Changing the display orientation**
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_inventorhub/display_orientation.py
|
||||
|
||||
**Example 6: Making your own images**
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_inventorhub/display_matrix.py
|
||||
|
||||
**Example 7: Combining images to make expressions**
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_inventorhub/display_expression.py
|
||||
|
||||
**Example 8: Displaying animations**
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_inventorhub/display_animate.py
|
||||
|
||||
.. automethod:: pybricks.hubs::InventorHub.display.orientation
|
||||
|
||||
.. automethod:: pybricks.hubs::InventorHub.display.off
|
||||
@@ -116,14 +50,6 @@ MINDSTORMS Inventor Hub
|
||||
.. figure:: ../../api/images/primehub_buttons_label.png
|
||||
:width: 22 em
|
||||
|
||||
.. toggle-header::
|
||||
:header: **Show/hide examples**
|
||||
|
||||
**Example: Detecting button presses**
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_inventorhub/button_main.py
|
||||
|
||||
.. automethod:: pybricks.hubs::InventorHub.buttons.pressed
|
||||
|
||||
.. rubric:: Using the speaker
|
||||
@@ -138,3 +64,89 @@ MINDSTORMS Inventor Hub
|
||||
|
||||
.. automethod:: pybricks.hubs::InventorHub.battery.current
|
||||
|
||||
Status light examples
|
||||
---------------------
|
||||
|
||||
Turning the light on and off
|
||||
****************************
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_inventorhub/light_off.py
|
||||
|
||||
Changing brightness and using custom colors
|
||||
*******************************************
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_inventorhub/light_hsv.py
|
||||
|
||||
Making the light blink
|
||||
**********************
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_inventorhub/light_blink.py
|
||||
|
||||
Creating light animations
|
||||
*************************
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_inventorhub/light_animate.py
|
||||
|
||||
Matrix display examples
|
||||
-----------------------
|
||||
|
||||
Displaying images
|
||||
*****************
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_inventorhub/display_image.py
|
||||
|
||||
Displaying numbers
|
||||
******************
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_inventorhub/display_number.py
|
||||
|
||||
Displaying text
|
||||
***************
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_inventorhub/display_text.py
|
||||
|
||||
Displaying individual pixels
|
||||
****************************
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_inventorhub/display_pixel.py
|
||||
|
||||
Changing the display orientation
|
||||
********************************
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_inventorhub/display_orientation.py
|
||||
|
||||
Making your own images
|
||||
**********************
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_inventorhub/display_matrix.py
|
||||
|
||||
Combining images to make expressions
|
||||
************************************
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_inventorhub/display_expression.py
|
||||
|
||||
Displaying animations
|
||||
*********************
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_inventorhub/display_animate.py
|
||||
|
||||
Button examples
|
||||
---------------
|
||||
|
||||
Detecting button presses
|
||||
************************
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_inventorhub/button_main.py
|
||||
|
||||
+27
-23
@@ -11,29 +11,6 @@ BOOST Move Hub
|
||||
|
||||
.. rubric:: Using the hub status light
|
||||
|
||||
.. toggle-header::
|
||||
:header: **Show/hide examples**
|
||||
|
||||
**Example 1: Turning the light on and off**
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_movehub/light_off.py
|
||||
|
||||
**Example 2: Changing brightness and using custom colors**
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_movehub/light_hsv.py
|
||||
|
||||
**Example 3: Making the light blink**
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_movehub/light_blink.py
|
||||
|
||||
**Example 4: Creating light animations**
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_movehub/light_animate.py
|
||||
|
||||
.. automethod:: pybricks.hubs::MoveHub.light.on
|
||||
|
||||
.. automethod:: pybricks.hubs::MoveHub.light.off
|
||||
@@ -47,3 +24,30 @@ BOOST Move Hub
|
||||
.. automethod:: pybricks.hubs::MoveHub.battery.voltage
|
||||
|
||||
.. automethod:: pybricks.hubs::MoveHub.battery.current
|
||||
|
||||
Status light examples
|
||||
---------------------
|
||||
|
||||
Turning the light on and off
|
||||
******************************
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_movehub/light_off.py
|
||||
|
||||
Changing brightness and using custom colors
|
||||
**************************************************
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_movehub/light_hsv.py
|
||||
|
||||
Making the light blink
|
||||
******************************
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_movehub/light_blink.py
|
||||
|
||||
Creating light animations
|
||||
******************************
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_movehub/light_animate.py
|
||||
|
||||
+87
-75
@@ -8,7 +8,7 @@ SPIKE Prime Hub
|
||||
:no-members:
|
||||
|
||||
This class is identical to the
|
||||
:class:`InventorHub <pybricks.hubs.InventorHub>` class, except
|
||||
:class:`PrimeHub <pybricks.hubs.PrimeHub>` class, except
|
||||
for the name.
|
||||
|
||||
.. rubric:: Using the hub status light
|
||||
@@ -16,29 +16,6 @@ SPIKE Prime Hub
|
||||
.. figure:: ../../api/images/primehub_light_label.png
|
||||
:width: 22 em
|
||||
|
||||
.. toggle-header::
|
||||
:header: **Show/hide examples**
|
||||
|
||||
**Example 1: Turning the light on and off**
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_primehub/light_off.py
|
||||
|
||||
**Example 2: Changing brightness and using custom colors**
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_primehub/light_hsv.py
|
||||
|
||||
**Example 3: Making the light blink**
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_primehub/light_blink.py
|
||||
|
||||
**Example 4: Creating light animations**
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_primehub/light_animate.py
|
||||
|
||||
.. automethod:: pybricks.hubs::PrimeHub.light.on
|
||||
|
||||
.. automethod:: pybricks.hubs::PrimeHub.light.off
|
||||
@@ -52,49 +29,6 @@ SPIKE Prime Hub
|
||||
.. figure:: ../../api/images/primehub_display_label.png
|
||||
:width: 22 em
|
||||
|
||||
.. toggle-header::
|
||||
:header: **Show/hide examples**
|
||||
|
||||
**Example 1: Displaying images**
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_primehub/display_image.py
|
||||
|
||||
**Example 2: Displaying numbers**
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_primehub/display_number.py
|
||||
|
||||
**Example 3: Displaying text**
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_primehub/display_text.py
|
||||
|
||||
**Example 4: Displaying individual pixels**
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_primehub/display_pixel.py
|
||||
|
||||
**Example 5: Changing the display orientation**
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_primehub/display_orientation.py
|
||||
|
||||
**Example 6: Making your own images**
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_primehub/display_matrix.py
|
||||
|
||||
**Example 7: Combining images to make expressions**
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_primehub/display_expression.py
|
||||
|
||||
**Example 8: Displaying animations**
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_primehub/display_animate.py
|
||||
|
||||
.. automethod:: pybricks.hubs::PrimeHub.display.orientation
|
||||
|
||||
.. automethod:: pybricks.hubs::PrimeHub.display.off
|
||||
@@ -116,14 +50,6 @@ SPIKE Prime Hub
|
||||
.. figure:: ../../api/images/primehub_buttons_label.png
|
||||
:width: 22 em
|
||||
|
||||
.. toggle-header::
|
||||
:header: **Show/hide examples**
|
||||
|
||||
**Example: Detecting button presses**
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_primehub/button_main.py
|
||||
|
||||
.. automethod:: pybricks.hubs::PrimeHub.buttons.pressed
|
||||
|
||||
.. rubric:: Using the speaker
|
||||
@@ -138,3 +64,89 @@ SPIKE Prime Hub
|
||||
|
||||
.. automethod:: pybricks.hubs::PrimeHub.battery.current
|
||||
|
||||
Status light examples
|
||||
---------------------
|
||||
|
||||
Turning the light on and off
|
||||
****************************
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_primehub/light_off.py
|
||||
|
||||
Changing brightness and using custom colors
|
||||
*******************************************
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_primehub/light_hsv.py
|
||||
|
||||
Making the light blink
|
||||
**********************
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_primehub/light_blink.py
|
||||
|
||||
Creating light animations
|
||||
*************************
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_primehub/light_animate.py
|
||||
|
||||
Matrix display examples
|
||||
-----------------------
|
||||
|
||||
Displaying images
|
||||
*****************
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_primehub/display_image.py
|
||||
|
||||
Displaying numbers
|
||||
******************
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_primehub/display_number.py
|
||||
|
||||
Displaying text
|
||||
***************
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_primehub/display_text.py
|
||||
|
||||
Displaying individual pixels
|
||||
****************************
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_primehub/display_pixel.py
|
||||
|
||||
Changing the display orientation
|
||||
********************************
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_primehub/display_orientation.py
|
||||
|
||||
Making your own images
|
||||
**********************
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_primehub/display_matrix.py
|
||||
|
||||
Combining images to make expressions
|
||||
************************************
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_primehub/display_expression.py
|
||||
|
||||
Displaying animations
|
||||
*********************
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_primehub/display_animate.py
|
||||
|
||||
Button examples
|
||||
---------------
|
||||
|
||||
Detecting button presses
|
||||
************************
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_primehub/button_main.py
|
||||
|
||||
+26
-23
@@ -9,29 +9,6 @@ Technic Hub
|
||||
|
||||
.. rubric:: Using the hub status light
|
||||
|
||||
.. toggle-header::
|
||||
:header: **Show/hide examples**
|
||||
|
||||
**Example 1: Turning the light on and off**
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_technichub/light_off.py
|
||||
|
||||
**Example 2: Changing brightness and using custom colors**
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_technichub/light_hsv.py
|
||||
|
||||
**Example 3: Making the light blink**
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_technichub/light_blink.py
|
||||
|
||||
**Example 4: Creating light animations**
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_technichub/light_animate.py
|
||||
|
||||
.. automethod:: pybricks.hubs::TechnicHub.light.on
|
||||
|
||||
.. automethod:: pybricks.hubs::TechnicHub.light.off
|
||||
@@ -46,3 +23,29 @@ Technic Hub
|
||||
|
||||
.. automethod:: pybricks.hubs::TechnicHub.battery.current
|
||||
|
||||
Status light examples
|
||||
---------------------
|
||||
|
||||
Turning the light on and off
|
||||
****************************
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_technichub/light_off.py
|
||||
|
||||
Changing brightness and using custom colors
|
||||
*******************************************
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_technichub/light_hsv.py
|
||||
|
||||
Making the light blink
|
||||
**********************
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_technichub/light_blink.py
|
||||
|
||||
Creating light animations
|
||||
*************************
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_technichub/light_animate.py
|
||||
|
||||
Reference in New Issue
Block a user