mirror of
https://github.com/pybricks/pybricks-api.git
synced 2026-09-12 01:24:17 +00:00
These code samples are rendered in the docs, so we include them here. For the git history of these snippets, see: https://github.com/pybricks/pybricks-projects/commits/f4914069aaacfd9ab1e0dd6f05524f62cfc56b29/snippets
23 lines
426 B
Python
23 lines
426 B
Python
from pybricks.hubs import ExampleHub
|
|
from pybricks.parameters import Color
|
|
from pybricks.tools import wait
|
|
|
|
# Initialize the hub.
|
|
hub = ExampleHub()
|
|
|
|
# MOVEHUB SKIP_NEXT 5
|
|
# Show the color at 30% brightness.
|
|
hub.light.on(Color.RED * 0.3)
|
|
|
|
wait(2000)
|
|
|
|
# Use your own custom color.
|
|
hub.light.on(Color(h=30, s=100, v=50))
|
|
|
|
wait(2000)
|
|
|
|
# Go through all the colors.
|
|
for hue in range(360):
|
|
hub.light.on(Color(hue))
|
|
wait(10)
|