Exemplo n.º 1
0
def morse_code(word_or_phrase: str,
               light_group: Union[Light, Group],
               delay_time_msec=TIME_QUANTUM_MS,
               settings: MCSettings = MCSettings()):
    """translate `word_or_phrase` into morse code that will appear on your lights"""
    light_group = Group([light_group]) if isinstance(light_group, Light) else light_group
    m = Morse.from_str(word_or_phrase)

    with light_group.reset_to_orig(3000):
        for c, length in m.to_char_and_len(delay_time_msec):
            light_group.set_color_power(settings.cp_from_char(c))
            time.sleep(length)
Exemplo n.º 2
0
 def zones(self, vals: List['Zone']):
     from lifxlan3 import Group
     self._zones = Group(vals, allow_dupes=True)
     self._init_grid()