Component: RGB Xmas Tree (Outputs: LEDs)

From Flowcode Help
Jump to navigationJump to search


Author MatrixTSL
Version 1.0 (Release)
Category Outputs: LEDs


Image RGB Xmas Tree component

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

Examples

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

Downloadable macro reference

PlayNote

Plays a specific note for the length of time specified.

Parameters

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


Return value

This call does not return a value


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.

Parameters

UINT Delay
Optional ms delay after the audio has stopped playing 0=No Delay


Return value

This call does not return a value


SetColours

Generates a colour value based on the input colour parameters and asigns it to all of the LEDs.

Parameters

BYTE Red
Red 0=None, 255=Max
BYTE Green
Green 0=None, 255=Max
BYTE Blue
Blue 0=None, 255=Max


Return value

This call does not return a value


RandomLED

Randomises the colour to a specific LED

Parameters

BYTE LED
LED 0 to NumLEDs - 1


Return value

This call does not return a value


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.

Parameters

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


Return value

This call does not return a value


SetLED

Directly sets the colour of a single LED.

Red = 3-bit, Green = 3-bit, Blue = 2-bit

0bBBGGGRRR

Parameters

BYTE LED
LED 0 to NumLEDs - 1
BYTE Colour


Return value

This call does not return a value


JingleBells

Plays the Jingle Bells tune using the audio driver.

Parameters

This macro has no parameters


Return value

This call does not return a value


SetLEDs

Sets the colour of all the LEDs.

Red = 3-bit, Green = 3-bit, Blue = 2-bit

0bBBGGGRRR

Parameters

BYTE Colour


Return value

This call does not return a value


CheckSwitch

Checks to see if the switch is pressed.

Returns 1 to indicate a press and 0 to indicate not pressed.

Parameters

This macro has no parameters


Return value

BYTE


SetColour

Generates a colour value based on the input colour parameters and asigns it to one of the LEDs.

Parameters

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


Return value

This call does not return a value


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.

Parameters

This macro has no parameters


Return value

BYTE


RandomLEDs

Randomises the colour of all the LEDs

Parameters

This macro has no parameters


Return value

This call does not return a value


GetLED

Directly read the colour of a single LED.

Red = 3-bit, Green = 3-bit, Blue = 2-bit

0bBBGGGRRR

Parameters

BYTE LED
LED 0 to NumLEDs - 1


Return value

BYTE


Initialise

Starts up the LED PWM and Audio software driver.

Parameters

This macro has no parameters


Return value

This call does not return a value


Simulation macro reference

This component does not contain any simulation macros


Property reference

LED Data Port

This property is of type Digital port byte and can be referenced with the variable name LED_Data_Port.

No additional information


LED Clock Pin

This property is of type Single digital pin and can be referenced with the variable name LED_Clock_Pin.

No additional information


LED Enable Pin

This property is of type Single digital pin and can be referenced with the variable name LED_Enable_Pin.

No additional information


Audio Output Pin

This property is of type Single digital pin and can be referenced with the variable name Audio_Pin.

No additional information


Switch Input Pin

This property is of type Single digital pin and can be referenced with the variable name Switch_Pin.

No additional information


Number Buffers

This property is of type Unsigned integer and can be referenced with the variable name NumBuffs.

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

This property is of type Unsigned integer and can be referenced with the variable name NumLEDs.

No additional information


Test On Startup

This property is of type True or false and can be referenced with the variable name TestStartup.

Performs a simple LED test routine on start up.

LEDs should all light up white, red, green and blue in second intervals.