mirror of
https://github.com/pybricks/pybricks-api.git
synced 2026-09-12 01:24:17 +00:00
102039385a9e9750aa2f9b5f90b24c66af05d50b
This adds the method equivalent to the recent addition of a single
color light. The only difference is that now a color is returned instead
of a single brightness. The provided color or HSV tuple will be stored
as RGB samples internally, as is already done for pbio light patterns.
In the simplest blinking form this could be:
hub.light.pattern(lambda t: Color.RED if t >= 1000 else None, 2000)
Or a fading, one-color sine:
def fade(time):
v = sin(time/2000/pi)*50+50
h = 360
s = 100
return (h, s, v)
hub.light.pattern(fade, 1000)
Pybricks end-user API & Documentation ===================================== This repository documents the Pybricks end-user MicroPython API. Each `Pybricks firmware`_ comes with the `Pybricks package`_. All modules, classes, methods, and functions in that package have optimized implementations in C for high performance and reduced memory footprint. This repository provides an empty, pure Python blueprint of that package. It is used to generate the `official documentation`_. See the `contributor's guide <CONTRIBUTING.md>`_ for acceptable changes and instructions to build the documentation locally. For general discussion, please visit the `support`_ issue tracker. .. _Pybricks package: pybricks .. _Pybricks firmware: https://github.com/pybricks/pybricks-micropython .. _official documentation: https://docs.pybricks.com/ .. _support: https://github.com/pybricks/support/issues
Languages
Python
99.1%
Shell
0.9%