|
20 | 20 | num_pixels = 21 |
21 | 21 | pixels = neopixel.NeoPixel(pixel_pin, num_pixels, brightness=0.8) |
22 | 22 | pixels.fill((0, 0, 0)) |
23 | | -COLOR = (0, 200, 0) # Green |
| 23 | +COLOR = (0, 200, 0) # Green |
24 | 24 |
|
25 | 25 | # 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 |
46 | 46 |
|
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 |
49 | 50 | if (the_hr == 24) and (the_min == 0): # Special cases: Midnight and Noon |
50 | 51 | return MIDNIGHT |
51 | 52 | if (the_hr == 12) and (the_min == 0): |
|
0 commit comments