Compare commits
2 Commits
810fefe323
...
d135c8c24f
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d135c8c24f | ||
|
|
bdcfdb9a9f |
24
pyleds/program/siinus/HzTick.py
Normal file
24
pyleds/program/siinus/HzTick.py
Normal file
@@ -0,0 +1,24 @@
|
||||
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)
|
||||
@@ -81,9 +81,9 @@
|
||||
<div class="spacer-row"></div>
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<button onclick="doInit()">init</button>
|
||||
<button onclick="doCancel()">end loop</button>
|
||||
<button onclick="doBlind()">off</button>
|
||||
<button onclick="doInit()">intro</button>
|
||||
<button onclick="doCancel()">halt</button>
|
||||
<button onclick="doBlind()">leds off</button>
|
||||
|
||||
<label><input type="checkbox" id="looping" /><b> loop</b></label>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user