3 # some constants to identify each LED
10 AMBER
= 1 # LED 0 = amber
11 RED
= 128 # LED 0 = red
12 GREEN
= 256 # LED 0 = green
14 BOTTOM6
= 2+4+8+16+32+64 # the 6 standard red LEDs
16 # note that we must tell setup() that we have a bicolour LED
17 tree
.setup() # you must always call setup() first!
19 # All the red LEDs will be permanently illuminated and we rotate
20 # between the various colours for the bicolour LED at the top.
21 for i
in range(7): # repeat 7 times
22 tree
.leds_on_and_wait(BOTTOM6
, 0.8) # top LED off
23 tree
.leds_on_and_wait(BOTTOM6
+ GREEN
, 0.8) # top LED green
24 tree
.leds_on_and_wait(BOTTOM6
+ RED
, 0.8) # top LED red
25 tree
.leds_on_and_wait(BOTTOM6
+ AMBER
, 0.8) # top LED amber
27 tree
.leds_on_and_wait(NO_LEDS
, 0.8) # all LEDs off
28 tree
.leds_on_and_wait(GREEN
, 0.8) # top LED green
29 tree
.leds_on_and_wait(RED
, 0.8) # top LED red
30 tree
.leds_on_and_wait(AMBER
, 0.8) # top LED amber
32 tree
.all_leds_off() # extinguish all LEDs
35 tree
.cleanup() # call cleanup() at the end