@@ -22,37 +22,41 @@ once set they will hold their value even if your code exits. This is potentially
22
22
useful to understand the current state of your code as it runs or the final
23
23
state of the code afterwards.
24
24
25
- Each channel of each LED acts independently, so you can either set them separately :
25
+ Each of the LEDs can be set to one of 8 colours :
26
26
27
27
~~~~~ python
28
- # Turn on the red channel of LED A
29
- R.kch.a.red = 1
28
+ # Set LED A to red
29
+ R.kch[UserLED.A] = Colour. RED
30
30
31
- # Turn on the green channel of LED B
32
- R.kch.b.green = 1
31
+ # Set LED B to cyan
32
+ R.kch[UserLED.B] = Colour. CYAN
33
33
34
- # Turn off the red channel of LED A
35
- R.kch.a.red = 0
34
+ # Turn LED C off
35
+ R.kch[UserLED.C] = Colour. OFF
36
36
~~~~~
37
37
38
- Alternatively you can set the red, green and blue channels for a given LED all together :
38
+ The available colours are :
39
39
40
40
~~~~~ python
41
- # Set LED C to a yellow colour
42
- R.kch.c.rgb = (1 , 1 , 0 )
43
-
44
- # Set LED B to a light blue colour
45
- R.kch.b.rgb = (0 , 1 , 1 )
41
+ OFF
42
+ RED
43
+ YELLOW
44
+ GREEN
45
+ CYAN
46
+ BLUE
47
+ MAGENTA
48
+ WHITE
46
49
~~~~~
47
50
48
- You can also access all the LEDs together :
51
+ Alternatively you can set the red, green and blue channels for a given LED separately :
49
52
50
53
~~~~~ python
51
- # Turn on the blue channel of all the LEDs
52
- for led in R.kch.leds.values():
53
- led.blue = 1
54
+ # Turn on the blue segment of LED A
55
+ R.kch[UserLED.A].b = True
56
+
57
+ # Turn off the red segment of LED B
58
+ R.kch[UserLED.B].r = False
54
59
55
- # Set all LEDs to a purple colour
56
- for led in R.kch.leds.values():
57
- led.rgb = (1 , 0 , 1 )
60
+ # Turn on green segment of LED B
61
+ R.kch[UserLED.B].g = True
58
62
~~~~~
0 commit comments