Skip to content

NeoPixel ​

Instance declaration ​

When you add a NeoPixel block to the workspace, the following instance declaration is automatically inserted into the Python code:

python
cheesestick = CheeseStick(0)
neopixel = cheesestick.NeoPixel()

Parameters ​

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

Start ​

Uses the NeoPixel.

start

Parameters ​

(none)

Python ​

python
cheesestick = CheeseStick(0)
neopixel = cheesestick.NeoPixel()

neopixel.start()

Set the color mode ​

Sets the LED mode of the NeoPixel.

mode

Parameters ​

NameKindDescriptionRange / TypeDefault
unitDropdown optionColor channel modeGRBW, GRBGRBW

Python ​

python
cheesestick = CheeseStick(0)
neopixel = cheesestick.NeoPixel()

neopixel.mode('GRBW')

Set the color of one pixel ​

Sets the color of a single pixel with the specified number.
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_one_color

Parameters ​

NameKindDescriptionRange / TypeDefault
idxInput (field)Pixel number (starting from 1)Integer 1 or greater-
colorColorPick from the color palette → converted to a color name (English)Color names: 'black', 'red', 'yellow', 'green', 'cyan', 'blue', 'magenta', 'white'-

Python ​

python
cheesestick = CheeseStick(0)
neopixel = cheesestick.NeoPixel()

neopixel.set_one_color(1, 'red')

Set the color of one pixel with a Color category block ​

Takes a Color category block as input and sets the color of one pixel.
The output of a color block (Utils.color() / Utils.color_rgb() / Utils.color_slider(), all of which return [R, G, B]) is unpacked with * (an asterisk) and passed as the r, g, b arguments of set_one_color.

set_one_color_with_block

Parameters ​

NameKindDescriptionRange / TypeDefault
idxInput (field)Pixel number (starting from 1)Integer 1 or greater-
dataInput (color)A Color category block or an [R, G, B] array[0~255, 0~255, 0~255]-

Python ​

python
cheesestick = CheeseStick(0)
neopixel = cheesestick.NeoPixel()

neopixel.set_one_color(1, *Utils.color('red'))

Change the color of one pixel by RGB ​

Adds the amounts of change to the current RGB values of the specified pixel to set a new color.

change_one_by_rgb

Parameters ​

NameKindDescriptionRange / TypeDefault
idxInput (field)Pixel number (starting from 1)Integer 1 or greater-
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)
neopixel = cheesestick.NeoPixel()

neopixel.change_one_color(1, 10, 0, 0)

Turn off one pixel ​

Removes the color of the nth LED.
The LED number ranges from 1 to 144.

turn_off_one

Parameters ​

NameKindDescriptionRange / TypeDefault
idxInput (field)Pixel number (starting from 1)Integer 1 or greater-

Python ​

python
cheesestick = CheeseStick(0)
neopixel = cheesestick.NeoPixel()

neopixel.turn_off_one(1)

Set a range pattern ​

Sets the color pattern of all the LEDs in the specified range.
The LED number ranges from 1 to 144.

set_range_pattern

Parameters ​

NameKindDescriptionRange / TypeDefault
from_idxInput (field)Start pixel number (starting from 1)Integer 1 or greater-
to_idxInput (field)End pixel number (starting from 1)Integer 1 or greater-
patternDropdown optionColor pattern name3_colors, 6_colors, 12_colors, red_green, red_blue, red_white, green_red, green_blue, green_white, blue_red, blue_green, blue_white, white_red, white_green, white_blue, black_red, black_green, black_blue, black_white, red_black, green_black, blue_black, white_black-

Python ​

python
cheesestick = CheeseStick(0)
neopixel = cheesestick.NeoPixel()

neopixel.set_range_pattern(1, 10, '3_colors')

Set the color of a range ​

Sets the same color for the entire specified pixel range.
When you pick a color from the color palette, it is converted to a color name (an English string) for the call.

set_range_color

Parameters ​

NameKindDescriptionRange / TypeDefault
from_idxInput (field)Start pixel number (starting from 1)Integer 1 or greater-
to_idxInput (field)End pixel number (starting from 1)Integer 1 or greater-
colorColorPick from the color palette → converted to a color name (English)Color names: 'black', 'red', 'yellow', 'green', 'cyan', 'blue', 'magenta', 'white'-

Python ​

python
cheesestick = CheeseStick(0)
neopixel = cheesestick.NeoPixel()

neopixel.set_range_color(1, 10, 'red')

Set the color of a range with a Color category block ​

Takes a Color category block as input and sets the color of a pixel range.
The output of a color block (Utils.color() / Utils.color_rgb() / Utils.color_slider()) is unpacked with * (an asterisk) and passed as the r, g, b arguments of set_range_color.

set_range_color_with_block

Parameters ​

NameKindDescriptionRange / TypeDefault
from_idxInput (field)Start pixel number (starting from 1)Integer 1 or greater-
to_idxInput (field)End pixel number (starting from 1)Integer 1 or greater-
dataInput (color)A Color category block or an [R, G, B] array[0~255, 0~255, 0~255]-

Python ​

python
cheesestick = CheeseStick(0)
neopixel = cheesestick.NeoPixel()

neopixel.set_range_color(1, 10, *Utils.color('red'))

Change the color of a range by RGB ​

Adds the RGB amounts of change to the current color of the specified pixel range to set a new color.

change_range_by_rgb

Parameters ​

NameKindDescriptionRange / TypeDefault
from_idxInput (field)Start pixel number (starting from 1)Integer 1 or greater-
to_idxInput (field)End pixel number (starting from 1)Integer 1 or greater-
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)
neopixel = cheesestick.NeoPixel()

neopixel.change_range_color(1, 10, 10, 0, 0)

Turn off the color of a range ​

Removes the color of all the LEDs in the specified range.
The LED number ranges from 1 to 144.

turn_off_range

Parameters ​

NameKindDescriptionRange / TypeDefault
from_idxInput (field)Start pixel number (starting from 1)Integer 1 or greater-
to_idxInput (field)End pixel number (starting from 1)Integer 1 or greater-

Python ​

python
cheesestick = CheeseStick(0)
neopixel = cheesestick.NeoPixel()

neopixel.turn_off_range(1, 10)

Set the color of a range every n pixels ​

Sets the color every increment pixels within the specified pixel range.
When you pick a color from the color palette, it is converted to a color name (an English string) for the call.
(For example, turning on only pixels 1, 3, 5, ...)

set_range_increment_color

Parameters ​

NameKindDescriptionRange / TypeDefault
from_idxInput (field)Start pixel number (starting from 1)Integer 1 or greater-
to_idxInput (field)End pixel number (starting from 1)Integer 1 or greater-
incrementInput (field)Interval (number of pixels)Integer 1 or greater-
colorColorPick from the color palette → converted to a color name (English)Color names: 'black', 'red', 'yellow', 'green', 'cyan', 'blue', 'magenta', 'white'-

Python ​

python
cheesestick = CheeseStick(0)
neopixel = cheesestick.NeoPixel()

neopixel.set_range_increment_color(1, 10, 2, 'red')

Set the color of a range every n pixels with a Color category block ​

Takes a Color category block as input and sets the color every n pixels within the specified pixel range.
The output of a color block (Utils.color() / Utils.color_rgb() / Utils.color_slider()) is unpacked with * (an asterisk) and passed as the r, g, b arguments of set_range_increment_color.

set_range_increment_color_with_block

Parameters ​

NameKindDescriptionRange / TypeDefault
from_idxInput (field)Start pixel number (starting from 1)Integer 1 or greater-
to_idxInput (field)End pixel number (starting from 1)Integer 1 or greater-
incrementInput (field)Interval (number of pixels)Integer 1 or greater-
dataInput (color)A Color category block or an [R, G, B] array[0~255, 0~255, 0~255]-

Python ​

python
cheesestick = CheeseStick(0)
neopixel = cheesestick.NeoPixel()

neopixel.set_range_increment_color(1, 10, 2, *Utils.color('red'))

Change a range by RGB every n pixels ​

Adds the RGB amounts of change to the current color of the pixels every n pixels to set a new color.

change_range_increment_by_rgb

Parameters ​

NameKindDescriptionRange / TypeDefault
from_idxInput (field)Start pixel number (starting from 1)Integer 1 or greater-
to_idxInput (field)End pixel number (starting from 1)Integer 1 or greater-
incrementInput (field)Increment interval (number of pixels)Integer 1 or greater-
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)
neopixel = cheesestick.NeoPixel()

neopixel.change_range_increment_color(1, 10, 2, 10, 0, 0)

Turn off the color of a range every n pixels ​

Removes the color of all the LEDs in the specified range and interval.
The LED number ranges from 1 to 144.

turn_off_range_increment

Parameters ​

NameKindDescriptionRange / TypeDefault
from_idxInput (field)Start pixel number (starting from 1)Integer 1 or greater-
to_idxInput (field)End pixel number (starting from 1)Integer 1 or greater-
incrementInput (field)Increment interval (number of pixels)Integer 1 or greater-

Python ​

python
cheesestick = CheeseStick(0)
neopixel = cheesestick.NeoPixel()

neopixel.turn_off_range_increment(1, 10, 2)

Shift / rotate ​

Shifts or rotates the LEDs by the specified direction and number of pixels.
The range of values you can choose is 1 to 143.

shift

Parameters ​

NameKindDescriptionRange / TypeDefault
unitDropdown optionKind of actionshift, rotate-
directionDropdown optionDirectionleft, right-
pixelInput (field)Number of pixels to moveInteger 1 or greater-

Python ​

python
cheesestick = CheeseStick(0)
neopixel = cheesestick.NeoPixel()

# unit = 'shift'
neopixel.shift('left', 1)

# unit = 'rotate'
neopixel.rotate('left', 1)

Set the brightness ​

Sets the brightness of the NeoPixel.
The range of values you can choose is 0 to 100.

set_brightness

Parameters ​

NameKindDescriptionRange / TypeDefault
valueInput (field)BrightnessInteger 0 to 100-

Python ​

python
cheesestick = CheeseStick(0)
neopixel = cheesestick.NeoPixel()

neopixel.set_brightness(50)

Change the brightness ​

Changes the brightness of the NeoPixel.
The range of values you can choose is -100 to 100.

change_brightness

Parameters ​

NameKindDescriptionRange / TypeDefault
valueInput (field)Amount of brightness changeInteger -100 to 100-

Python ​

python
cheesestick = CheeseStick(0)
neopixel = cheesestick.NeoPixel()

neopixel.change_brightness(10)