Skip to content

Commit a6d0fef

Browse files
authored
SR2024 - Update Section - Brain board LEDs
2 parents 10e01b9 + 0442894 commit a6d0fef

File tree

1 file changed

+16
-19
lines changed

1 file changed

+16
-19
lines changed

programming/leds.md

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,37 +6,34 @@ title: Brain Board LED API
66
Brain Board LED API
77
===================
88

9-
<div class="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.
1211

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.
1714

1815
The LEDs on the KCH can be accessed via the `kch` object:
1916

2017
~~~~~ python
21-
R.kch.something...
18+
robot.kch
2219
~~~~~
2320

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.
2825

2926
Each of the LEDs can be set to one of 8 colours:
3027

3128
~~~~~ python
3229
# Set LED A to red
33-
R.kch.leds[UserLED.A] = Colour.RED
30+
robot.kch.leds[LED_A].colour = Colour.RED
3431

3532
# Set LED B to cyan
36-
R.kch.leds[UserLED.B] = Colour.CYAN
33+
robot.kch.leds[LED_B].colour = Colour.CYAN
3734

3835
# Turn LED C off
39-
R.kch.leds[UserLED.C] = Colour.OFF
36+
robot.kch.leds[LED_C].colour = Colour.OFF
4037
~~~~~
4138

4239
The available colours are:
@@ -56,11 +53,11 @@ Alternatively you can set the red, green and blue channels for a given LED separ
5653

5754
~~~~~ python
5855
# Turn on the blue segment of LED A
59-
R.kch.leds[UserLED.A].b = True
56+
robot.kch.leds[LED_A].b = True
6057

6158
# Turn off the red segment of LED B
62-
R.kch.leds[UserLED.B].r = False
59+
robot.kch.leds[LED_B].r = False
6360

64-
# Turn on green segment of LED B
65-
R.kch.leds[UserLED.B].g = True
61+
# Turn on the green segment of LED B
62+
robot.kch.leds[LED_B].g = True
6663
~~~~~

0 commit comments

Comments
 (0)