pattern module

pattern.py - Module for creating light patterns.

author:Martin Norbury (martin.norbury@gmail.com)
pattern.color_sequence(targets, ramp_time=10)[source]

Generate a color sequence.

Parameters:
  • targets – Target colors e.g. [‘red’, ‘blue’, ‘green’]
  • ramp_time – Time to ramp up to target RGB.
Returns:

Color sequence generator. This generator is infinite and continues to return the last value once the

variable components are complete.

pattern.pulse_rgb(rgb, loop_time, frequency=1, decay_time=None)[source]

Pulse the RGB channels.

Parameters:
  • rgb – The target RGB e.g. (255, 0, 0)
  • loop_time – The time between each loop call e.g. 0.1s
  • frequency – The frequency of the pulse (default 1Hz)
  • decay_time – The amplitude decay time (s)
Returns:

A generator.