Initial commit of Xmas tree
[pi-xmas.git] / xmas_tree / example_3.py
1 import tree
2
3 # Some constants to identify each LED
4 L0 = 1
5 L1 = 2
6 L2 = 4
7 L3 = 8
8 L4 = 16
9 L5 = 32
10 L6 = 64
11 ALL = 1+2+4+8+16+32+64
12 NO_LEDS = 0
13
14 tree.setup() # you must always call setup() first!
15
16 # Pattern: all LEDs illuminated except for one each time
17
18 for i in range(3): # repeat 3 times
19 tree.leds_on_and_wait(ALL-L0, 0.5) # all on except for LED 0
20 tree.leds_on_and_wait(ALL-L1, 0.5) # all on except for LED 1
21 tree.leds_on_and_wait(ALL-L2, 0.5) # etc.
22 tree.leds_on_and_wait(ALL-L3, 0.5)
23 tree.leds_on_and_wait(ALL-L4, 0.5)
24 tree.leds_on_and_wait(ALL-L5, 0.5)
25 tree.leds_on_and_wait(ALL-L6, 0.5)
26
27
28 tree.all_leds_off() # extinguish all LEDs
29
30 # All done!
31 tree.cleanup() # call cleanup() at the end
32