Skip to content

Commit 2638b13

Browse files
committed
invoke bracha mode
1 parent 1516fdf commit 2638b13

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

WS2801_LED_Menorah/code.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
pixel_prev = [128] * len(pixels)
2323

2424
lit_candles = None
25-
night = 1
25+
night = 0
2626
timestamp = None
2727

2828
def split(first, second, offset):
@@ -48,14 +48,17 @@ def split(first, second, offset):
4848
time.sleep(0.01) # debounce
4949
night += 1 # next night
5050
if night == 9: # wrap around
51-
night = 1
51+
night = 0 # shamash-only mode
5252
lit_candles = None # reset the lights
5353
if not lit_candles:
5454
print("Current night: ", night)
5555
night_countup = 0
5656
timestamp = time.monotonic()-1
5757

58-
if (night_countup != night) and (time.monotonic() - timestamp >= 1):
58+
if night == 0:
59+
# special case of shamash-only
60+
lit_candles = [False, False, False, False, True, False, False, False, False]
61+
elif (night_countup != night) and (time.monotonic() - timestamp >= 1):
5962
# we slowly 'light' up the candles from left to right, once a second
6063
night_countup += 1
6164
lit_candles = [False] * (8-night) + [True] * night_countup + [False] * (night-night_countup)

0 commit comments

Comments
 (0)