Difference between revisions of "Component: RGB Xmas Tree (Misc Circuit)"

From Flowcode Help
Jump to navigationJump to search
Line 22: Line 22:
  
 
==Detailed description==
 
==Detailed description==
 +
 +
  
  
Line 52: Line 54:
  
  
For more information please refer to the [http://www.matrixtsl.com/blog/led-xmas-tree-project-2/ Xmas Tree blog post].
 
  
==Macro reference==
 
  
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
+
For more information please refer to the [http://www.matrixtsl.com/blog/led-xmas-tree-project-2/ Xmas Tree blog post].
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''PlayNote'''
 
|-
 
| colspan="2" | Plays a specific note for the length of time specified. 
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | Note
 
|-
 
| 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-u16-icon.png]] - UINT
 
| width="90%" | Length
 
|-
 
| colspan="2" |  
 
|-
 
| 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''
 
|}
 
  
  
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''WaitAudio'''
 
|-
 
| 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="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
  
 
+
==Macro reference==
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''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-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''RandomLED'''
 
|-
 
| colspan="2" | Randomises the colour to a specific LED 
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | LED
 
|-
 
| colspan="2" | LED 0 to NumLEDs - 1 
 
|-
 
| 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''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''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. 
 
|-
 
|-
 
| 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%" | 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" | [[File:Fc9-u16-icon.png]] - UINT
 
| width="90%" | TransistionDelay
 
|-
 
| colspan="2" | Delay in milliseconds between each transition 
 
|-
 
| 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''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''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="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''JingleBells'''
 
|-
 
| 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="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SetLEDs'''
 
|-
 
| 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="90%" | Colour
 
|-
 
| colspan="2" |  
 
|-
 
| 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''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''CheckSwitch'''
 
|-
 
| 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="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SetColour'''
 
|-
 
| colspan="2" | Generates a colour value based on the input colour parameters and asigns it to one of the LEDs. 
 
|-
 
|-
 
| 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%" | 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-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''CheckAudio'''
 
|-
 
| 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="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''RandomLEDs'''
 
|-
 
| colspan="2" | Randomises the colour of all the LEDs 
 
|-
 
|-
 
| 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''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetLED'''
 
|-
 
| 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="90%" | LED
 
|-
 
| colspan="2" | LED 0 to NumLEDs - 1 
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''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="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
 
 
 
 
==Property reference==
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-prop-icon.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Properties'''
 
|-
 
|-
 
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
 
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Pin Connections
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-19-icon.png]]
 
| width="90%" | LED Data Port
 
|-
 
| colspan="2" |  
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
 
| width="90%" | LED Clock Pin
 
|-
 
| colspan="2" |  
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
 
| width="90%" | LED Enable Pin
 
|-
 
| colspan="2" |  
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
 
| width="90%" | Audio Output Pin
 
|-
 
| colspan="2" |  
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
 
| width="90%" | Switch Input Pin
 
|-
 
| colspan="2" |  
 
|-
 
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
 
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | LED Properties
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
 
| width="90%" | Number Buffers
 
|-
 
| colspan="2" | 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. 
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
 
| width="90%" | Number LEDs
 
|-
 
| colspan="2" |  
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-7-icon.png]]
 
| width="90%" | Test On Startup
 
|-
 
| colspan="2" | Performs a simple LED test routine on start up. LEDs should all light up white, red, green and blue in second intervals. 
 
|}==Macro reference==
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''PlayNote'''
 
|-
 
| colspan="2" | Plays a specific note for the length of time specified. 
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | Note
 
|-
 
| 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-u16-icon.png]] - UINT
 
| width="90%" | Length
 
|-
 
| colspan="2" |  
 
|-
 
| 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''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''WaitAudio'''
 
|-
 
| 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="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''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-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''RandomLED'''
 
|-
 
| colspan="2" | Randomises the colour to a specific LED 
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | LED
 
|-
 
| colspan="2" | LED 0 to NumLEDs - 1 
 
|-
 
| 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''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''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. 
 
|-
 
|-
 
| 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%" | 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" | [[File:Fc9-u16-icon.png]] - UINT
 
| width="90%" | TransistionDelay
 
|-
 
| colspan="2" | Delay in milliseconds between each transition 
 
|-
 
| 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''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''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="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''JingleBells'''
 
|-
 
| 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="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SetLEDs'''
 
|-
 
| 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="90%" | Colour
 
|-
 
| colspan="2" |  
 
|-
 
| 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''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''CheckSwitch'''
 
|-
 
| 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="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SetColour'''
 
|-
 
| colspan="2" | Generates a colour value based on the input colour parameters and asigns it to one of the LEDs. 
 
|-
 
|-
 
| 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%" | 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-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''CheckAudio'''
 
|-
 
| 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="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''RandomLEDs'''
 
|-
 
| colspan="2" | Randomises the colour of all the LEDs 
 
|-
 
|-
 
| 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''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetLED'''
 
|-
 
| 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="90%" | LED
 
|-
 
| colspan="2" | LED 0 to NumLEDs - 1 
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''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="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
 
 
 
 
==Property reference==
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-prop-icon.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Properties'''
 
|-
 
|-
 
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
 
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Pin Connections
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-19-icon.png]]
 
| width="90%" | LED Data Port
 
|-
 
| colspan="2" |  
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
 
| width="90%" | LED Clock Pin
 
|-
 
| colspan="2" |  
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
 
| width="90%" | LED Enable Pin
 
|-
 
| colspan="2" |  
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
 
| width="90%" | Audio Output Pin
 
|-
 
| colspan="2" |  
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
 
| width="90%" | Switch Input Pin
 
|-
 
| colspan="2" |  
 
|-
 
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
 
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | LED Properties
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
 
| width="90%" | Number Buffers
 
|-
 
| colspan="2" | 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. 
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
 
| width="90%" | Number LEDs
 
|-
 
| colspan="2" |  
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-7-icon.png]]
 
| width="90%" | Test On Startup
 
|-
 
| colspan="2" | Performs a simple LED test routine on start up. LEDs should all light up white, red, green and blue in second intervals. 
 
|}==Macro reference==
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''PlayNote'''
 
|-
 
| colspan="2" | Plays a specific note for the length of time specified. 
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | Note
 
|-
 
| 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-u16-icon.png]] - UINT
 
| width="90%" | Length
 
|-
 
| colspan="2" |  
 
|-
 
| 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''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''WaitAudio'''
 
|-
 
| 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="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''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-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''RandomLED'''
 
|-
 
| colspan="2" | Randomises the colour to a specific LED 
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | LED
 
|-
 
| colspan="2" | LED 0 to NumLEDs - 1 
 
|-
 
| 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''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''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. 
 
|-
 
|-
 
| 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%" | 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" | [[File:Fc9-u16-icon.png]] - UINT
 
| width="90%" | TransistionDelay
 
|-
 
| colspan="2" | Delay in milliseconds between each transition 
 
|-
 
| 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''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''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="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''JingleBells'''
 
|-
 
| 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="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SetLEDs'''
 
|-
 
| 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="90%" | Colour
 
|-
 
| colspan="2" |  
 
|-
 
| 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''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''CheckSwitch'''
 
|-
 
| 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="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SetColour'''
 
|-
 
| colspan="2" | Generates a colour value based on the input colour parameters and asigns it to one of the LEDs. 
 
|-
 
|-
 
| 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%" | 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-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''CheckAudio'''
 
|-
 
| 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="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''RandomLEDs'''
 
|-
 
| colspan="2" | Randomises the colour of all the LEDs 
 
|-
 
|-
 
| 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''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetLED'''
 
|-
 
| 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="90%" | LED
 
|-
 
| colspan="2" | LED 0 to NumLEDs - 1 
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''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="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
 
 
 
 
==Property reference==
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-prop-icon.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Properties'''
 
|-
 
|-
 
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
 
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Pin Connections
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-19-icon.png]]
 
| width="90%" | LED Data Port
 
|-
 
| colspan="2" |  
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
 
| width="90%" | LED Clock Pin
 
|-
 
| colspan="2" |  
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
 
| width="90%" | LED Enable Pin
 
|-
 
| colspan="2" |  
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
 
| width="90%" | Audio Output Pin
 
|-
 
| colspan="2" |  
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
 
| width="90%" | Switch Input Pin
 
|-
 
| colspan="2" |  
 
|-
 
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
 
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | LED Properties
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
 
| width="90%" | Number Buffers
 
|-
 
| colspan="2" | 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. 
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
 
| width="90%" | Number LEDs
 
|-
 
| colspan="2" |  
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-7-icon.png]]
 
| width="90%" | Test On Startup
 
|-
 
| colspan="2" | Performs a simple LED test routine on start up. LEDs should all light up white, red, green and blue in second intervals. 
 
|}==Macro reference==
 
  
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"

Revision as of 16:50, 30 January 2023

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

Fc9-comp-macro.png PlayNote
Plays a specific note for the length of time specified. 
Fc9-u8-icon.png - 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... 
Fc9-u16-icon.png - UINT Length
 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png 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. 
Fc9-u16-icon.png - UINT Delay
Optional ms delay after the audio has stopped playing 0=No Delay 
Fc9-void-icon.png - VOID Return


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


Fc9-comp-macro.png RandomLED
Randomises the colour to a specific LED 
Fc9-u8-icon.png - BYTE LED
LED 0 to NumLEDs - 1 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png 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. 
Fc9-u8-icon.png - BYTE LED
LED 0 to NumLEDs - 1 
Fc9-u8-icon.png - BYTE Red
Red 0=None, 255=Max 
Fc9-u8-icon.png - BYTE Green
Green 0=None, 255=Max 
Fc9-u8-icon.png - BYTE Blue
Blue 0=None, 255=Max 
Fc9-u16-icon.png - UINT TransistionDelay
Delay in milliseconds between each transition 
Fc9-void-icon.png - VOID Return


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


Fc9-comp-macro.png JingleBells
Plays the Jingle Bells tune using the audio driver. 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png SetLEDs
Sets the colour of all the LEDs. Red = 3-bit, Green = 3-bit, Blue = 2-bit 0bBBGGGRRR 
Fc9-u8-icon.png - BYTE Colour
 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png CheckSwitch
Checks to see if the switch is pressed. Returns 1 to indicate a press and 0 to indicate not pressed. 
Fc9-u8-icon.png - BYTE Return


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


Fc9-comp-macro.png 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. 
Fc9-u8-icon.png - BYTE Return


Fc9-comp-macro.png RandomLEDs
Randomises the colour of all the LEDs 
Fc9-void-icon.png - VOID Return


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


Fc9-comp-macro.png Initialise
Starts up the LED PWM and Audio software driver. 
Fc9-void-icon.png - VOID Return



Property reference

Fc9-prop-icon.png Properties
Fc9-conn-icon.png Pin Connections
Fc9-type-19-icon.png LED Data Port
 
Fc9-type-5-icon.png LED Clock Pin
 
Fc9-type-5-icon.png LED Enable Pin
 
Fc9-type-5-icon.png Audio Output Pin
 
Fc9-type-5-icon.png Switch Input Pin
 
Fc9-conn-icon.png LED Properties
Fc9-type-21-icon.png 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. 
Fc9-type-21-icon.png Number LEDs
 
Fc9-type-7-icon.png 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.