LEARN.PARALLAX.COM
Published on LEARN.PARALLAX.COM (https://learn.parallax.com)
Home > RGB LEDs

RGB LEDs

BlocklyProp reference for RGB LED blocks

For Activity Board, FLiP, and Other board types. Not available for Badge or Scribbler Robot board types.

BlocklyProp supports just one RGB-LED Init block per project, so if you want to use multiple RGB LEDs, chain them together instead of wiring them to separate Propeller I/O pins. These blocks are intended for WS2812B RGB LED modules (Parallax #28025 & 28026).

]


RGB-LED init

This block launches a processor automatically, one per block instance.

The RGB-LED init block is used to specify the Propeller I/O pin connected to the RGB LED module(s), and to also specify the number of LEDs chained together. If you forget to use this block, other RGB-LED blocks will remind you with a triangle-shaped warning icon:

  • In the first drop-down field select the Propeller I/O pin connected to the signal input pin of the first RGB LED, in a chain of 1 or more LEDs.
  • In the second field, enter the number of RGB LEDs chained together.
  • In the third drop-down, specify the type of RGB LEDs being used (WS2812 is the only initial option).

If you use more than one RGB-LED init block in a project, the RGB-LED set and RBG-LED update blocks will provide a dropdown for selecting the targeted Propeller I/O pin for a given set of RGB-LEDs.


RGB-LED set

The RGB-LED set block allows you to choose a color for a specific RGB LED.

  • In the number field, Insert a number value specifying the location of the target RGB LED in the chain.  RGB LED number 1 is the unit directly connected to the Propeller I/O pin.
  • In the color field, insert a color value. Click its window and choose a color* from the pop-up menu.
  • If you are using more than one RGB-LED init block in a project, select the Propeller I/O pin for the target RGB LED(s) from the dropdown that will appear.

Use a new block to set the color for each RGB LED in the chain. The settings will not take effect until the program execution reaches an RGB-LED update block.

*Keep in mind that with WS2812B LEDs, brightness and current draw will vary by color, with white being the brightest and most power-consuming setting.


RGB-LED set multiple

The RGB-LED set block allows you to choose a color for a specific contiguous range of RGB LEDs chained together.

  • In the first number field, Insert a number value specifying the location of the first target RGB LED in the chain.  RGB LED number 1 is the unit directly connected to the Propeller I/O pin.
  • In the second number field, Insert a number value specifying the location of the last target RGB LED in the desired chain. 
  • In the color field, insert a color value. Or, click its window and choose a color* from the pop-up menu.
  • If you are using more than one RGB-LED init block in a project, select the Propeller I/O pin for the target RGB LED(s) from the dropdown that will appear.

Use a new block to set the color for each RGB LED in the chain. The settings will not take effect until the program execution reaches an RGB-LED update block.

*Keep in mind that with WS2812B LEDs, brightness and current draw will vary by color, with white being the brightest and most power-consuming setting.


RGB-LED update

The RGB-LED update block updates all of the RGB LED colors to the settings specified in the most recent RGB-LED set blocks. Each time the colors are changed with RGB-LED set blocks, the RGB-LED update block must be used again to see the new colors.

If you use more than one RGB-LED init block in a project, the RBG-LED update blocks will provide a dropdown for selecting the targeted Propeller I/O pin for a given set of RGB-LEDs.

DISCUSSION FORUMS | PARALLAX INC. STORE

About | Terms of Use | Feedback: learn@parallax.com | Copyright©Parallax Inc. 2024


Source URL:https://learn.parallax.com/reference/propeller-blocklyprop-block-reference/rgb-leds/
Links