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
16 lines
279 B
Python
16 lines
279 B
Python
from pybricks.hubs import MoveHub
|
|
from pybricks.parameters import Color
|
|
from pybricks.tools import wait
|
|
|
|
# Initialize the hub.
|
|
hub = MoveHub()
|
|
|
|
# Turn the light on and off 5 times.
|
|
for i in range(5):
|
|
|
|
hub.light.on(Color.RED)
|
|
wait(1000)
|
|
|
|
hub.light.off()
|
|
wait(500)
|