Skip to content

CSD-02 RGB LED ​

Instance declaration ​

When you add a CSD-02 RGB LED block to the workspace, the following instance declaration is automatically inserted into the Python code:

python
cheesestick = CheeseStick(0)
csd02 = cheesestick.CSD02()

Parameters ​

NameKindDescriptionRange / TypeDefault
indexDropdown optionInstance number (starting from 0)Integer 0 or greater0

Start the RGB LED ​

Starts using the RGB LED.
If you do not add this block, the RGB LED is not activated.

start

Parameters ​

(none)

Python ​

python
cheesestick = CheeseStick(0)
csd02 = cheesestick.CSD02()

csd02.start()

Set the color ​

Sets the LED color of CSD02 to the specified color.
When you pick a color from the color palette, it is converted to a color name (an English string) for the call. (The generated code uses a color name, not R, G, B numeric values.)

set_color

Parameters ​

NameKindDescriptionRange / TypeDefault
colorColorPick from the color palette → converted to a color name (English)Color names: 'black', 'red', 'orange', 'yellow', 'green', 'cyan', 'blue', 'violet', 'magenta', 'white'-

Python ​

python
cheesestick = CheeseStick(0)
csd02 = cheesestick.CSD02()

csd02.set_color('orange')

Set the color with a Color category block ​

Takes a Color category block (for example an [R, G, B] array) as input and sets the LED color of CSD02.

set_color_with_block

Parameters ​

NameKindDescriptionRange / TypeDefault
dataInput (color)The output of a Color category block or an [R, G, B] array[0~255, 0~255, 0~255]-

Python ​

python
cheesestick = CheeseStick(0)
csd02 = cheesestick.CSD02()

csd02.set_color(*Utils.color('yellow'))

Change the color by RGB ​

Adds the R, G, and B amounts you enter to the current LED color to set a new color.

change_by_rgb

Parameters ​

NameKindDescriptionRange / TypeDefault
rInput (field)Amount of red changeInteger -255 to 2550
gInput (field)Amount of green changeInteger -255 to 2550
bInput (field)Amount of blue changeInteger -255 to 2550

Python ​

python
cheesestick = CheeseStick(0)
csd02 = cheesestick.CSD02()

csd02.change_color(10, 0, 0)

Turn off LED ​

Removes the RGB LED color.

turn_off

Parameters ​

(none)

Python ​

python
cheesestick = CheeseStick(0)
csd02 = cheesestick.CSD02()

csd02.turn_off()