You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: programming/leds.md
+16-19Lines changed: 16 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,37 +6,34 @@ title: Brain Board LED API
6
6
Brain Board LED API
7
7
===================
8
8
9
-
<divclass="info">
10
-
This documentation refers to a feature which is only available on the physical robot kits.
11
-
</div>
9
+
The KCH board provides diagnostic information about the state of your robot through a collection of preconfigured and user-controllable LEDs.
10
+
It is part of the [Brain Board](/docs/kit/brain_board) assembly and will be found attached to the top of the Raspberry Pi.
12
11
13
-
The KCH HAT provides diagnostic information about the state of your robot
14
-
through a collection of preconfigured and user-controllable LEDs. It is part of
15
-
the [Brain Board](/docs/kit/brain_board) assembly, however control of its LEDs
16
-
is provided through a distinct API.
12
+
A number of the LEDs are controlled by the Robot's Operating system, the description of these is provided on the [Brain Board](/docs/kit/brain_board) page.
13
+
There are also three LEDs that you can control via the API.
17
14
18
15
The LEDs on the KCH can be accessed via the `kch` object:
19
16
20
17
~~~~~python
21
-
R.kch.something...
18
+
robot.kch
22
19
~~~~~
23
20
24
-
The KCH HAT has three RGB LEDs: A, B and C. The LEDs default to off, however
25
-
once set they will hold their value even if your code exits. This is potentially
26
-
useful to understand the current state of your code as it runs or the final
27
-
state of the code afterwards.
21
+
The KCH board has three RGB (red/green/blue) LEDs: A, B and C.
22
+
23
+
The LEDs default to off, however once set they will hold their value even if your code exits.
24
+
This is potentially useful to understand the current state of your code as it runs or the final state of the code afterwards.
28
25
29
26
Each of the LEDs can be set to one of 8 colours:
30
27
31
28
~~~~~python
32
29
# Set LED A to red
33
-
R.kch.leds[UserLED.A]= Colour.RED
30
+
robot.kch.leds[LED_A].colour= Colour.RED
34
31
35
32
# Set LED B to cyan
36
-
R.kch.leds[UserLED.B]= Colour.CYAN
33
+
robot.kch.leds[LED_B].colour= Colour.CYAN
37
34
38
35
# Turn LED C off
39
-
R.kch.leds[UserLED.C]= Colour.OFF
36
+
robot.kch.leds[LED_C].colour= Colour.OFF
40
37
~~~~~
41
38
42
39
The available colours are:
@@ -56,11 +53,11 @@ Alternatively you can set the red, green and blue channels for a given LED separ
0 commit comments