Files
pybricks-api/examples/pup/hub_shared/light_hsv.py
T
Laurens Valk 018b0d8b9d examples: simplify hub script generator
Instead of saying that some lines should be skipped, just say for which hubs the entire script will work.
2021-01-20 10:56:21 +01:00

23 lines
447 B
Python

# ExampleHub = CityHub TechnicHub PrimeHub
from pybricks.hubs import ExampleHub
from pybricks.parameters import Color
from pybricks.tools import wait
# Initialize the hub.
hub = ExampleHub()
# 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)