Jump to content

Component: RGB LED WS2811 / WS2812 / APA106 (LEDs)

From Flowcode Help
Revision as of 12:20, 3 February 2023 by Wiki bot (talk | contribs)
Author Matrix TSL
Version 1.5
Category LEDs


RGB LED WS2811 / WS2812 / APA106 component

A simple chained RGB LED controller IC allowing multiple LEDs to be controlled using a serial data stream. Compatible with the WS2811, WS2812, WS2812B, APA104 and APA106 Type Controller ICs. Allows RGB LEDs to be driven with full 24-bit colour depth. Allows single chains, 2D arrays and 3D cube formations to be simulated. Requires a high speed microcontroller to generate the critical timings to drive the device.

Component Source Code

Please click here to download the component source project: FC_Comp_Source_temp/LED_WS2811.fcfx

Please click here to view the component source code (Beta): FC_Comp_Source_temp/LED_WS2811.fcfx

Detailed description

No detailed description exists yet for this component

Examples

No additional examples





Macro reference

Delay_T0H

Delay_T0H
 
- VOID Return


Delay_T0L

Delay_T0L
 
- VOID Return


Delay_T1H

Delay_T1H
 
- VOID Return


Delay_T1L

Delay_T1L
 
- VOID Return


DrawCuboid3D

DrawCuboid3D
Draws a basic 3D cuboid onto the LEDs 
- BYTE X1
Start X pixel coordinate 
- BYTE Y1
Start Y pixel coordinate 
- BYTE Z1
Start Z pixel coordinate 
- BYTE X2
End X pixel coordinate 
- BYTE Y2
End Y pixel coordinate 
- BYTE Z2
End Z pixel coordinate 
- BYTE DrawStyle
Sets the draw style - 0=Soild, 1=Edge, 2=Corners 
- BYTE R
Red Colour Channel 
- BYTE G
Green Colour Channel 
- BYTE B
White Colour Channel 
- VOID Return


DrawLine2D

DrawLine2D
Draws a line on a 2D array of LEDs 
- UINT X1
Start X Coordinate 
- UINT Y1
Start Y Coordinate 
- UINT X2
End X Coordinate 
- UINT Y2
End Y Coordinate 
- BYTE R
Red colour channel 
- BYTE G
Green colour channel 
- BYTE B
Blue colour channel 
- VOID Return


DrawLine3D

DrawLine3D
Draws a line on a 3D array of LEDs 
- UINT X1
Start X Coordinate 
- UINT Y1
Start Y Coordinate 
- UINT Z1
Start Z Coordinate 
- UINT X2
End X Coordinate 
- UINT Y2
End Y Coordinate 
- UINT Z2
End Z Coordinate 
- BYTE R
Red Colour Channel 
- BYTE G
Green Colour Channel 
- BYTE B
Blue Colour Channel 
- VOID Return


DrawRectangle2D

DrawRectangle2D
Draws a basic 2D rectangle onto the LEDs 
- BYTE X1
 
- BYTE Y1
 
- BYTE X2
 
- BYTE Y2
 
- BYTE DrawStyle
Sets the draw style - 0=Soild, 1=Edge, 2=Corners 
- BYTE R
 
- BYTE G
 
- BYTE B
 
- VOID Return


GetLEDColour

GetLEDColour
Sets the colour of a single LED in RAM as a 1D array. 
- UINT LED
LED to change the colour / Range: 0 to (LED Count - 1) 
- BYTE ColIdx
0 = Red, 1 = Green, 2 = Blue 
- BYTE Return


GetLEDIndex2D

GetLEDIndex2D
Sets the index of a single LED in RAM as a 2D array. 
- UINT X
LED Column to change the colour / Range: 0 to (LED Column - 1) 
- UINT Y
LED Row to change the colour / Range: 0 to (LED Row - 1) 
- UINT Return


GetLEDIndex3D

GetLEDIndex3D
Gets the index of a single LED in RAM as a 3D array. 
- UINT X
LED Column to change the colour / Range: 0 to (LED Column - 1) 
- UINT Y
LED Row to change the colour / Range: 0 to (LED Row - 1) 
- UINT Z
LED Layer to change the colour / Range: 0 to (LED Layer - 1) 
- UINT Return


Initialise

Initialise
Inisialises the RGB colour RAM to 0,0,0 = LED Off and clocks out the data to initialise all the LED ICs in the chain. 
- VOID Return


OutputHigh

OutputHigh
 
- VOID Return


OutputLow

OutputLow
 
- VOID Return


Refresh

Refresh
Clocks out the current colour data to the LEDs from the values stored in RAM 
- VOID Return


SetAllLEDColour

SetAllLEDColour
Sets the colour of all the LEDs in RAM 
- BYTE R
Red Colour Channel 
- BYTE G
Green Colour Channel 
- BYTE B
Blue Colour Channel 
- VOID Return


SetBrightness

SetBrightness
Allows the output colour brightness of the LEDs to be scaled down. For example to save current usage or to reduce brightness in dark environments.  
- FLOAT Scaler
Range: 0.0 to 1.0 Default: 1.0, 0 = Off, 0.5 = Half Brightness, 1.0 = Full Brightness 
- VOID Return


SetBrightnessByte

SetBrightnessByte
Allows the output colour brightness of the LEDs to be scaled down. For example to save current usage or to reduce brightness in dark environments.  
- BYTE Scaler
Range: 0 to 255 Default: 255, 0 = Off, 128 = Half Brightness, 255 = Full Brightness 
- VOID Return


SetLEDColour

SetLEDColour
Sets the colour of a single LED in RAM as a 1D array. 
- UINT LED
LED to change the colour / Range: 0 to (LED Count - 1) 
- BYTE R
Red Colour Channel 
- BYTE G
Green Colour Channel 
- BYTE B
Blue Colour Channel 
- VOID Return


ShiftLEDs1D

ShiftLEDs1D
Shifts the LED colours in 1D and wraps  
- BYTE Direction
0 = Forwards, 1 = Backwards 
- BYTE DataMode
0=ResetToZero, 1=WrapAroundDisplay, 2=Smear 
- VOID Return


ShiftLEDs2D

ShiftLEDs2D
Shifts the contents of the display by the number of vertices specified ***Please Note that Wrap mode is currently unavailable*** 
- INT X
Number of pixels to shift the display -1 to 1 / 0 = No Shift 
- INT Y
Number of pixels to shift the display -1 to 1 / 0 = No Shift 
- BYTE DataMode
0=ResetToZero, 1=WrapAroundDisplay, 2=Smear 
- VOID Return


ShiftLEDs3D

ShiftLEDs3D
Shifts the contents of the display by the number of vertices specified ***Please Note that Wrap mode is currently unavailable*** 
- INT X
Number of pixels to shift the display -1 to 1 / 0 = No Shift 
- INT Y
Number of pixels to shift the display -1 to 1 / 0 = No Shift 
- INT Z
Number of pixels to shift the display -1 to 1 / 0 = No Shift 
- BYTE DataMode
0=ResetToZero, 1=WrapAroundDisplay, 2=Smear 
- VOID Return


Property reference

Properties
Controller IC
LED Controller
Allows the user to select which LED controller IC they are using. The different controller ICs all work the same way but have different timing characteristics. 
Data Order
Configures the order the colour data is clocked out to the LEDs 
Reset Time (uS)
Blanking reset period to reset the LED shift chain and start from the beginning 
T0H (uS)
Logic 0 high time in microseconds 
T0L (uS)
Logic 0 low time in microseconds 
T1H (uS)
Logic 1 high time in microseconds 
T1L (uS)
Logic 1 low time in microseconds 
LED Properties
LED Arrangement
Controls the arrangement of the LEDs on the panel. 1D - Creates a straight line of LEDs 2D - Creates an X by Y Array of LEDs 3D - Creates an X by Y by Z Array of LEDs 
LED Count
Total number of LEDs in the design 
Arrangement
LEDs will likely be arranged in one of two ways. Parallel = Each row of LEDs run from left to right - easier to address but harder to wire. Alternating = Each row of LEDs runs in an alternating direction - harder to address but easier to wire. 
Column Count
Number of horizontal LEDs - X axis 
Column Spacing
X Spacing Between LEDs on the Panel 
Row Count
Number of vertical LEDs - Y axis 
Row Spacing
Y Spacing Between LEDs on the Panel 
Layer Count
Number of LED layers - Z axis 
Layer Spacing
Z Spacing Between LEDs on the Panel 
Flip X
Flips the X axis if the LEDs are wired from the right hand side of the display. 
Flip Y
Flips the Y axis if the LEDs are wired from the under side of the display. 
Flip Z
Flips the X axis if the LEDs are wired from the upper most side of the display. 
Connections
Data Pin
LED Data Pin - Connected to the Data In pin of the first WS821x IC. 
Invert Data