Skip to content

Commit 9469c22

Browse files
authored
Update code.py
1 parent efc25b4 commit 9469c22

1 file changed

Lines changed: 24 additions & 23 deletions

File tree

  • CircuitPython_Simple_Wordclock

CircuitPython_Simple_Wordclock/code.py

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -20,32 +20,33 @@
2020
num_pixels = 21
2121
pixels = neopixel.NeoPixel(pixel_pin, num_pixels, brightness=0.8)
2222
pixels.fill((0, 0, 0))
23-
COLOR = (0, 200, 0) # Green
23+
COLOR = (0, 200, 0) # Green
2424

2525
# Bitmap values for each value. These can be OR'ed together
26-
THREE = 0b00000000000000000001
27-
EIGHT = 0b00000000000000000010
28-
ELEVEN = 0b00000000000000000100
29-
TWO = 0b00000000000000001000
30-
SIX = 0b00000000000000010000
31-
FOUR = 0b00000000000000100000
32-
SEVEN = 0b00000000000001000000
33-
NOON = 0b00000000000010000000
34-
TEN = 0b00000000000100000000
35-
ONE = 0b00000000001000000000
36-
FIVE = 0b00000000010000000000
37-
MIDNIGHT = 0b00000000100000000000
38-
NINE = 0b00000001000000000000
39-
PAST = 0b00000010000000000000
40-
TO = 0b00000100000000000000
41-
FIVEMIN = 0b00001000000000000000
42-
QUARTER = 0b00010000000000000000
43-
TENMIN = 0b00100000000000000000
44-
HALF = 0b01000000000000000000
45-
TWENTY = 0b10000000000000000000
26+
THREE = 1
27+
EIGHT = 1<<1
28+
ELEVEN = 1<<2
29+
TWO = 1<<3
30+
SIX = 1<<4
31+
FOUR = 1<<5
32+
SEVEN = 1<<6
33+
NOON = 1<<7
34+
TEN = 1<<8
35+
ONE = 1<<9
36+
FIVE = 1<<10
37+
MIDNIGHT = 1<<11
38+
NINE = 1<<12
39+
PAST = 1<<13
40+
TO = 1<<14
41+
FIVEMIN = 1<<15
42+
QUARTER = 1<<16
43+
TENMIN = 1<<17
44+
HALF = 1<<18
45+
TWENTY = 1<<19
4646

47-
def writetime(the_hr, the_min): # Pass in hour and minute, return LED bitmask
48-
value = 0b00000000000000000000
47+
# Pass in hour and minute, return LED bitmask
48+
def writetime(the_hr, the_min):
49+
value = 0 # Start with zero, which is no words
4950
if (the_hr == 24) and (the_min == 0): # Special cases: Midnight and Noon
5051
return MIDNIGHT
5152
if (the_hr == 12) and (the_min == 0):

0 commit comments

Comments
 (0)