Initial commit of Xmas tree
[pi-xmas.git] / xmas_tree / example_2.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: two or three LEDs are on at the same time.
17 # Note that each pair is on for 0.4 seconds
18
19 for i in range(7): # repeat the pattern 7 times
20 tree.leds_on_and_wait(L1+L4, 0.4) # LED 1 and LED 4
21 tree.leds_on_and_wait(L5+L3+L0, 0.4) # LEDs 5, 3 and 0
22 tree.leds_on_and_wait(L2+L6, 0.4) # LEDs 2 and 6
23 tree.leds_on_and_wait(L5+L3+L0, 0.4) # LEDs 5, 3 and 0
24
25
26 tree.all_leds_off() # extinguish all LEDs
27
28 # All done!
29 tree.cleanup() # call cleanup() at the end
30
31
32
33
34
35