diff --git a/doc/api/hubs_cityhub.inc b/doc/api/hubs_cityhub.inc index 521afd0..083b295 100644 --- a/doc/api/hubs_cityhub.inc +++ b/doc/api/hubs_cityhub.inc @@ -7,6 +7,12 @@ .. automethod:: pybricks.hubs::CityHub.light.off +.. .. automethod:: pybricks.hubs::CityHub.light.hsv + +.. .. automethod:: pybricks.hubs::CityHub.light.pattern + +.. .. automethod:: pybricks.hubs::CityHub.light.reset + .. rubric:: Using the battery .. automethod:: pybricks.hubs::CityHub.battery.voltage diff --git a/doc/api/pupdevices.rst b/doc/api/pupdevices.rst index 91f8442..3f0f04a 100644 --- a/doc/api/pupdevices.rst +++ b/doc/api/pupdevices.rst @@ -248,3 +248,5 @@ Light .. automethod:: pybricks.pupdevices.Light.on .. automethod:: pybricks.pupdevices.Light.off + +.. .. automethod:: pybricks.pupdevices.Light.pattern diff --git a/pybricks/_common.py b/pybricks/_common.py index dc15a04..210d9b1 100644 --- a/pybricks/_common.py +++ b/pybricks/_common.py @@ -405,20 +405,17 @@ class Light: pass def pattern(self, pattern, duration): - """Make the light brightness follow a pattern as a function of time. + """Makes the light brightness follow a pattern as a function of time. The specified pattern function will be sampled at 64 points between 0 and the specified duration. The light will be held at a constant brightness between samples. After the given duration, the pattern repeats. - This function is not blocking. The pattern will be shown as the - user program continues. - Arguments: pattern (callable): Function of the - form ``b = func(t)``` that returns the brightness ``b`` - of the (0--100.0) as a function of time ``t`` in milliseconds. + form ``b = func(t)`` that returns the brightness ``b`` as a + function of time ``t`` in milliseconds. time (:ref:`time`): Duration of the pattern. """ @@ -445,7 +442,7 @@ class ColorLight: pass def hsv(self, hue, saturation=100, value=100): - """Set the hue, saturation and brightness of the light. + """Sets the hue, saturation and brightness of the light. Arguments: hue (:ref:`hue`): Hue of the color. @@ -455,21 +452,19 @@ class ColorLight: pass def pattern(self, pattern, duration): - """Make the light follow a color pattern as a function of time. + """Makes the light follow a color pattern as a function of time. The specified pattern function will be sampled at 64 points between 0 and the specified duration. The light will be held constant between samples. After the given duration, the pattern repeats. - This function is not blocking. The pattern will be shown as the - user program continues. - Arguments: pattern (callable): Function of the - form ``h, s, v = func(t)``` that returns a tuple of ``h``, + form ``h, s, v = func(t)`` that returns a tuple of ``h``, ``s``, and ``v`` as a function of time ``t`` in milliseconds. - Instead of an HSV tuple, you may return - a :class:`Button <.parameters.Color>` for simplicity. + A function of the + form :class:`col <.parameters.Color>` ``= func(t)`` is also + allowed. time (:ref:`time`): Duration of the pattern. """