Compare commits
No commits in common. 'd135c8c24f53296df34d26c7275a6d7970dc8bdf' and '810fefe32371d8f075a551599001add014528ff7' have entirely different histories.
d135c8c24f
...
810fefe323
2 changed files with 3 additions and 27 deletions
@ -1,24 +0,0 @@ |
|||||||
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: |
|
||||||
|
|
||||||
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() |
|
||||||
|
|
||||||
# Needs accurate time calculation to tick exactly when real second is passed |
|
||||||
time.sleep(1) |
|
Loading…
Reference in new issue