Component: RGB Xmas Tree (Misc Circuit): Difference between revisions
Appearance
Created page with "{| style="width:50%" |- | width="20%" style="color:gray;" | Author | MatrixTSL |- | width="20%" style="color:gray;" | Version | 1.0 |- | width="20%" style="color:gray;..." |
m Text replacement - "style="background-color:#EAE1EA;"" to "class="mtx-class-propfolder"" |
||
| (16 intermediate revisions by 2 users not shown) | |||
| Line 15: | Line 15: | ||
Component complete with macros and simultion to drive the MatrixTSL RGB Xmas Tree decoration. | Component complete with macros and simultion to drive the MatrixTSL RGB Xmas Tree decoration. | ||
==Component | ==Component Source Code== | ||
Please click here to download the component source project: [https://www.flowcode.co.uk/wiki/componentsource/FC_Comp_Source_XmasTree.fcfx FC_Comp_Source_XmasTree.fcfx] | |||
Please click here to view the component source code (Beta): [https://www.flowcode.co.uk/FlowchartView/?wfile=componentsource/FC_Comp_Source_XmasTree.fcfx FC_Comp_Source_XmasTree.fcfx] | |||
==Detailed description== | ==Detailed description== | ||
''No detailed description exists yet for this component'' | ''No detailed description exists yet for this component'' | ||
==Examples== | ==Examples== | ||
For more information please refer to the [http://www.matrixtsl.com/blog/led-xmas-tree-project-2/ Xmas Tree blog post]. | For more information please refer to the [http://www.matrixtsl.com/blog/led-xmas-tree-project-2/ Xmas Tree blog post]. | ||
{| class="wikitable | |||
==Macro reference== | |||
===CheckAudio=== | |||
{| class="mtx-class-macrotable wikitable" | |||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''CheckAudio''' | ||
|- | |- | ||
| colspan="2" | | | colspan="2" | Checks to see if the audio circuit is current outputting a tone. Returns 1 to indicate audio active and 0 to indicate not active. | ||
|- | |- | ||
|- | |- | ||
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE | |||
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9- | |||
| width="90%" style="border-top: 2px solid #000;" | ''Return'' | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
|} | |} | ||
{| class="wikitable | ===CheckSwitch=== | ||
{| class="mtx-class-macrotable wikitable" | |||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''CheckSwitch''' | ||
|- | |- | ||
| colspan="2" | Checks to see if the | | colspan="2" | Checks to see if the switch is pressed. Returns 1 to indicate a press and 0 to indicate not pressed. | ||
|- | |- | ||
|- | |- | ||
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE | |||
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9- | |||
| width="90%" style="border-top: 2px solid #000;" | ''Return'' | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
|} | |} | ||
{| class="wikitable | ===GetLED=== | ||
{| class="mtx-class-macrotable wikitable" | |||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''GetLED''' | ||
|- | |- | ||
| colspan="2" | | | colspan="2" | Directly read the colour of a single LED. Red = 3-bit, Green = 3-bit, Blue = 2-bit 0bBBGGGRRR | ||
|- | |- | ||
|- | |- | ||
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | ||
| width="90%" | | | width="90%" | LED | ||
|- | |- | ||
| colspan="2" | | | colspan="2" | LED 0 to NumLEDs - 1 | ||
|- | |- | ||
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE | ||
| width="90%" | | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
|} | |||
===Initialise=== | |||
{| class="mtx-class-macrotable wikitable" | |||
|- | |- | ||
| | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" class="mtx-class-macrohead" | '''Initialise''' | |||
|- | |- | ||
| | | colspan="2" | Starts up the LED PWM and Audio software driver. | ||
|- | |- | ||
|- | |- | ||
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID | ||
| Line 99: | Line 131: | ||
{| class="wikitable | ===JingleBells=== | ||
{| class="mtx-class-macrotable wikitable" | |||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''JingleBells''' | ||
|- | |- | ||
| colspan="2" | | | colspan="2" | Plays the Jingle Bells tune using the audio driver. | ||
|- | |- | ||
|- | |- | ||
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID | ||
| Line 117: | Line 145: | ||
{| class="wikitable | ===MoveToColour=== | ||
{| class="mtx-class-macrotable wikitable" | |||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''MoveToColour''' | ||
|- | |- | ||
| colspan="2" | 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. | | colspan="2" | 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. | ||
| Line 155: | Line 184: | ||
{| class="wikitable | ===PlayNote=== | ||
{| class="mtx-class-macrotable wikitable" | |||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''PlayNote''' | ||
|- | |- | ||
| colspan="2" | | | colspan="2" | Plays a specific note for the length of time specified. | ||
|- | |- | ||
|- | |- | ||
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | ||
| width="90%" | | | width="90%" | Note | ||
|- | |- | ||
| colspan="2" | | | colspan="2" | 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... | ||
|- | |- | ||
| width="10%" align="center" | [[File:Fc9- | | width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT | ||
| width="90%" | | | width="90%" | Length | ||
|- | |- | ||
| colspan="2" | | | colspan="2" | | ||
| Line 178: | Line 208: | ||
{| class="wikitable | ===RandomLED=== | ||
{| class="mtx-class-macrotable wikitable" | |||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''RandomLED''' | ||
|- | |- | ||
| colspan="2" | | | colspan="2" | Randomises the colour to a specific LED | ||
|- | |- | ||
|- | |- | ||
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | ||
| width="90%" | | | width="90%" | LED | ||
|- | |- | ||
| colspan="2" | | | colspan="2" | LED 0 to NumLEDs - 1 | ||
|- | |- | ||
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID | ||
| Line 209: | Line 227: | ||
{| class="wikitable | ===RandomLEDs=== | ||
{| class="mtx-class-macrotable wikitable" | |||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''RandomLEDs''' | ||
|- | |- | ||
| colspan="2" | | | colspan="2" | Randomises the colour of all the LEDs | ||
|- | |- | ||
|- | |- | ||
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9- | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID | ||
| width="90%" style="border-top: 2px solid #000;" | ''Return'' | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
|} | |} | ||
{| class="wikitable | ===SetColour=== | ||
{| class="mtx-class-macrotable wikitable" | |||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''SetColour''' | ||
|- | |- | ||
| colspan="2" | Generates a colour value based on the input colour parameters and asigns it to one of the LEDs. | | colspan="2" | Generates a colour value based on the input colour parameters and asigns it to one of the LEDs. | ||
| Line 255: | Line 275: | ||
{| class="wikitable | ===SetColours=== | ||
{| class="mtx-class-macrotable wikitable" | |||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''SetColours''' | ||
|- | |||
| colspan="2" | Generates a colour value based on the input colour parameters and asigns it to all of the LEDs. | |||
|- | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | |||
| width="90%" | Red | |||
|- | |||
| colspan="2" | Red 0=None, 255=Max | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | |||
| width="90%" | Green | |||
|- | |||
| colspan="2" | Green 0=None, 255=Max | |||
|- | |- | ||
| | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | ||
| width="90%" | Blue | |||
|- | |- | ||
| colspan="2" | Blue 0=None, 255=Max | |||
|- | |- | ||
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9- | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID | ||
| width="90%" style="border-top: 2px solid #000;" | ''Return'' | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
|} | |} | ||
{| class="wikitable" | ===SetLED=== | ||
{| class="mtx-class-macrotable wikitable" | |||
|- | |||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | |||
| width="90%" class="mtx-class-macrohead" | '''SetLED''' | |||
|- | |||
| colspan="2" | Directly sets the colour of a single LED. Red = 3-bit, Green = 3-bit, Blue = 2-bit 0bBBGGGRRR | |||
|- | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | |||
| width="90%" | LED | |||
|- | |- | ||
| | | colspan="2" | LED 0 to NumLEDs - 1 | ||
|- | |- | ||
| | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | ||
| width="90%" | Colour | |||
|- | |- | ||
| colspan="2" | | |||
|- | |- | ||
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID | ||
| Line 281: | Line 328: | ||
{| class="wikitable | ===SetLEDs=== | ||
{| class="mtx-class-macrotable wikitable" | |||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''SetLEDs''' | ||
|- | |- | ||
| colspan="2" | | | colspan="2" | Sets the colour of all the LEDs. Red = 3-bit, Green = 3-bit, Blue = 2-bit 0bBBGGGRRR | ||
|- | |- | ||
|- | |- | ||
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | ||
| width="90%" | | | width="90%" | Colour | ||
|- | |- | ||
| colspan="2" | | | colspan="2" | | ||
|- | |- | ||
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9- | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID | ||
| width="90%" style="border-top: 2px solid #000;" | ''Return'' | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
|} | |} | ||
{| class="wikitable | ===WaitAudio=== | ||
{| class="mtx-class-macrotable wikitable" | |||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''WaitAudio''' | ||
|- | |- | ||
| colspan="2" | | | colspan="2" | 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. | ||
|- | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT | |||
| width="90%" | Delay | |||
|- | |- | ||
| colspan="2" | Optional ms delay after the audio has stopped playing 0=No Delay | |||
|- | |- | ||
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID | ||
| width="90%" style="border-top: 2px solid #000;" | ''Return'' | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
|} | |} | ||
==Property reference== | ==Property reference== | ||
{| class="wikitable | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-prop-icon.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''Properties''' | ||
|- | |||
|- | |||
| width="10%" align="center" class="mtx-class-propfolder" | [[File:Fc9-conn-icon.png]] | |||
| width="90%" class="mtx-class-propfolder" | Pin Connections | |||
|- | |- | ||
|- | |- | ||
| Line 346: | Line 402: | ||
|- | |- | ||
| colspan="2" | | | colspan="2" | | ||
|- | |||
| width="10%" align="center" class="mtx-class-propfolder" | [[File:Fc9-conn-icon.png]] | |||
| width="90%" class="mtx-class-propfolder" | LED Properties | |||
|- | |||
|- | |- | ||
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]] | | width="10%" align="center" | [[File:Fc9-type-21-icon.png]] | ||
| Line 361: | Line 421: | ||
|- | |- | ||
| colspan="2" | Performs a simple LED test routine on start up. LEDs should all light up white, red, green and blue in second intervals. | | colspan="2" | Performs a simple LED test routine on start up. LEDs should all light up white, red, green and blue in second intervals. | ||
|} | |} | ||
Latest revision as of 14:37, 13 July 2026
| 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. | |
| Return | |
CheckSwitch
| CheckSwitch | |
| Checks to see if the switch is pressed. Returns 1 to indicate a press and 0 to indicate not pressed. | |
| Return | |
GetLED
| GetLED | |
| Directly read the colour of a single LED. Red = 3-bit, Green = 3-bit, Blue = 2-bit 0bBBGGGRRR | |
| LED | |
| LED 0 to NumLEDs - 1 | |
| Return | |
Initialise
| Initialise | |
| Starts up the LED PWM and Audio software driver. | |
| Return | |
JingleBells
| JingleBells | |
| Plays the Jingle Bells tune using the audio driver. | |
| Return | |
MoveToColour
PlayNote
| PlayNote | |
| Plays a specific note for the length of time specified. | |
| 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... | |
| Length | |
| Return | |
RandomLED
| RandomLED | |
| Randomises the colour to a specific LED | |
| LED | |
| LED 0 to NumLEDs - 1 | |
| Return | |
RandomLEDs
| RandomLEDs | |
| Randomises the colour of all the LEDs | |
| Return | |
SetColour
SetColours
SetLED
| SetLED | |
| Directly sets the colour of a single LED. Red = 3-bit, Green = 3-bit, Blue = 2-bit 0bBBGGGRRR | |
| LED | |
| LED 0 to NumLEDs - 1 | |
| Colour | |
| Return | |
SetLEDs
| SetLEDs | |
| Sets the colour of all the LEDs. Red = 3-bit, Green = 3-bit, Blue = 2-bit 0bBBGGGRRR | |
| Colour | |
| Return | |
WaitAudio