mirror of
https://github.com/pybricks/pybricks-api.git
synced 2026-09-11 17:14:41 +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
22 lines
404 B
Python
22 lines
404 B
Python
from pybricks.hubs import TechnicHub
|
|
from pybricks.parameters import Color
|
|
from pybricks.tools import wait
|
|
|
|
# Initialize the hub.
|
|
hub = TechnicHub()
|
|
|
|
# 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)
|