You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
678 B
22 lines
678 B
from lib.Program import Program |
|
import time |
|
|
|
|
|
def name(): |
|
return '1Hz tick' |
|
|
|
|
|
# Tick seconds like analog clock |
|
class HzTick(Program): |
|
def run(self, args: [] = None) -> None: |
|
tempo = self._lm.get_tempo() |
|
|
|
while self.get_loop().status(): |
|
second = time.localtime().tm_sec |
|
second_pixel = int(self._lm.count_pixels() / 60 * second) |
|
color_arr = args['color'] |
|
for i in range(self._lm.count_pixels()): |
|
self._lm.set_pixel_color(i, (color_arr[0] << 16) | (color_arr[1] << 8) | color_arr[2]) |
|
self._lm.set_pixel_color(second_pixel, 255) |
|
self._lm.show() |
|
tempo.wait()
|
|
|