Jump to content

Component: RGB Xmas Tree (Misc Circuit)

From Flowcode Help
Revision as of 14:37, 13 July 2026 by SteveT (talk | contribs) (Text replacement - "style="background-color:#EAE1EA;"" to "class="mtx-class-propfolder"")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Author MatrixTSL
Version 1.0
Category Misc Circuit


RGB Xmas Tree component

Component complete with macros and simultion to drive the MatrixTSL RGB Xmas Tree decoration.

Component Source Code

Please click here to download the component source project: FC_Comp_Source_XmasTree.fcfx

Please click here to view the component source code (Beta): FC_Comp_Source_XmasTree.fcfx

Detailed description

No detailed description exists yet for this component

Examples

For more information please refer to the Xmas Tree blog post.






Macro reference

CheckAudio

CheckAudio
Checks to see if the audio circuit is current outputting a tone. Returns 1 to indicate audio active and 0 to indicate not active. 
- BYTE Return


CheckSwitch

CheckSwitch
Checks to see if the switch is pressed. Returns 1 to indicate a press and 0 to indicate not pressed. 
- BYTE Return


GetLED

GetLED
Directly read the colour of a single LED. Red = 3-bit, Green = 3-bit, Blue = 2-bit 0bBBGGGRRR 
- BYTE LED
LED 0 to NumLEDs - 1 
- BYTE Return


Initialise

Initialise
Starts up the LED PWM and Audio software driver. 
- VOID Return


JingleBells

JingleBells
Plays the Jingle Bells tune using the audio driver. 
- VOID Return


MoveToColour

MoveToColour
Generates a colour value based on the input colour parameters and transitions one of the LEDs to the new colour. Remains in the function until the new colour has been reached. 
- BYTE LED
LED 0 to NumLEDs - 1 
- BYTE Red
Red 0=None, 255=Max 
- BYTE Green
Green 0=None, 255=Max 
- BYTE Blue
Blue 0=None, 255=Max 
- UINT TransistionDelay
Delay in milliseconds between each transition 
- VOID Return


PlayNote

PlayNote
Plays a specific note for the length of time specified. 
- BYTE Note
0-59 - 0=C, 1=C#, 2=D, 3=Eb, 4=E, 5=F, 6=F#, 7=G, 8=G#, 9=A, 10=Bb, 11=B, 12=C... 
- UINT Length
 
- VOID Return


RandomLED

RandomLED
Randomises the colour to a specific LED 
- BYTE LED
LED 0 to NumLEDs - 1 
- VOID Return


RandomLEDs

RandomLEDs
Randomises the colour of all the LEDs 
- VOID Return


SetColour

SetColour
Generates a colour value based on the input colour parameters and asigns it to one of the LEDs. 
- BYTE LED
LED 0 to NumLEDs - 1 
- BYTE Red
Red 0=None, 255=Max 
- BYTE Green
Green 0=None, 255=Max 
- BYTE Blue
Blue 0=None, 255=Max 
- VOID Return


SetColours

SetColours
Generates a colour value based on the input colour parameters and asigns it to all of the LEDs. 
- BYTE Red
Red 0=None, 255=Max 
- BYTE Green
Green 0=None, 255=Max 
- BYTE Blue
Blue 0=None, 255=Max 
- VOID Return


SetLED

SetLED
Directly sets the colour of a single LED. Red = 3-bit, Green = 3-bit, Blue = 2-bit 0bBBGGGRRR 
- BYTE LED
LED 0 to NumLEDs - 1 
- BYTE Colour
 
- VOID Return


SetLEDs

SetLEDs
Sets the colour of all the LEDs. Red = 3-bit, Green = 3-bit, Blue = 2-bit 0bBBGGGRRR 
- BYTE Colour
 
- VOID Return


WaitAudio

WaitAudio
Checks to see if the audio circuit is current outputting a tone. If it is then the macro will wait until the audio is free again. 
- UINT Delay
Optional ms delay after the audio has stopped playing 0=No Delay 
- VOID Return


Property reference

Properties
Pin Connections
LED Data Port
 
LED Clock Pin
 
LED Enable Pin
 
Audio Output Pin
 
Switch Input Pin
 
LED Properties
Number Buffers
Number of octal buffer IC's you will require to drive the LEDs. Note that the microcontroller data port provides the first buffer so the numbr of ICs is actually one less than the value shown. 
Number LEDs
 
Test On Startup
Performs a simple LED test routine on start up. LEDs should all light up white, red, green and blue in second intervals.