Component: LED Array Template (Outputs: LEDs)

From Flowcode Help
Jump to navigationJump to search


Author Matrix TSL
Version 2.0 (Release)
Category Outputs: LEDs


Image LED Array Template component

Create an evenly spaced array of LED indicators. Each will be connected to sequential pins of a given I/O port. Set target object to point at any standard LED component to change the style.

This component can be used as a base to create child components

Image The component LED Array (PCB) is inherited from this.

Examples

Example program which uses the point graph macro and loops to create a knight rider effect using the LED array. FC6 Icon.png LED KnightRider Example program which reads an analogue value from an analogue input voltage and displays the reading in Binary on the LED array. FC6 Icon.png LED Count LEDs can be wired either active high or active low. The LED Array components have a property allowing you to configure which LED type your using.

LED Active.jpg


An active high LED will light when the microcontroller pin is outputting a logic 1 and be off when the microcontroller pin is outputting a logic 0 or in input mode.


An active low LED will light when the microcontroller pin is outputting a logic 0 and be off when the microcontroller pin is outputting a logic 1 or in input mode.


The series resistor can be on either side of the LED and acts to protect the LED from damage due to excess current. The value of resistor used can be changed based on the brightness of the LED and power consumption.


This LED Calculator tool is a good resource for calculating the correct LED series protection resistor.

LED Resistor Calculator Tool

Downloadable macro reference

BarGraph

Turns on the first N elements of the array - for generating bar graph metes etc.

Parameters

BYTE Length
How many items to light up.


Return value

This call does not return a value


LEDOn

Turn on the selected LED.

Parameters

BYTE Index
Index of the LED to turn on.


Return value

This call does not return a value


AllOn

Turns on all elements

Parameters

This macro has no parameters


Return value

This call does not return a value


LEDOff

Turn off the selected led.

Parameters

BYTE Index
Index of the LED to turn on.


Return value

This call does not return a value


PointGraph

Turns on the Indexed LED and turns all others off.

Does nothing if the index is out of range.

Parameters

BYTE Index
The LED to show.


Return value

This call does not return a value


WriteValue

Write a number which is presented on the LEDs in binary.

Parameters

BYTE Value
Provide a value to be written to the LEDs in binary


Return value

This call does not return a value


AllOff

Turns off all elements

Parameters

This macro has no parameters


Return value

This call does not return a value


Simulation macro reference

GetHandle

Retrieves the object handle of the indexed clone.

Returns zero for out of range indexes.

Parameters

BYTE Index


Return value

HANDLE



Property reference

Count

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

The number of LEDs in the array from 1 to 8.

Output Mode

This property is of type Fixed list of ints and can be referenced with the variable name port.

Choose a single port for all LEDs, or to allocate them to arbitrary pins.

Port

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

No additional information


Polarity

This property is of type Fixed list of ints and can be referenced with the variable name polarity.

Active High = LEDs light when the chosen chip pin is ON

Active Low = LEDs light when the chosen chip pin is OFF

Alignment

This property is of type Fixed list of ints and can be referenced with the variable name align.

Which 3D axis to align the copies along.

Spacing

This property is of type Floating point and can be referenced with the variable name spacing.

The distance between LEDs in the array.

LEDs will be spaced symmetrically around the component centre.

Use a negative value to reverse the order of the LEDs.

Reverse

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

Reverse the direction of the LEDs.

Target LED

This property is of type Panel object and can be referenced with the variable name target_object.

Drag any LED component based on the 'LED base' onto the panel and

select it here to use a custom LED design.

When unconnected, you can choose a default geometric form instead.

Shape

This property is of type Fixed list of ints and can be referenced with the variable name shape.

Shape for the LED when no target is selected.

Width

This property is of type Floating point and can be referenced with the variable name width.

Width of the LED shape.

Height

This property is of type Floating point and can be referenced with the variable name height.

Height of the LED shape.

Depth

This property is of type Floating point and can be referenced with the variable name depth.

Depth of the LED shape.

Same Color

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

Choose whether all LEDs should be the same color, or to set them individually.

LED 0

This property is of type Color picker and can be referenced with the variable name color_led0.

The colour for LED 0 - or for all LEDs if that option is set.

Show

This property is of type Fixed list of ints and can be referenced with the variable name show_label.

Decide what labels to show...

None - no labels are displayed

Name - shows each component's name

Property - shows a particular property of each component (see 'property' below.

Property

This property is of type Line of text and can be referenced with the variable name label_property.

Show a particular property of each object. If a port or pin property is chosen, the label can be abbreviated

to remove the '$PORT' text.

Color

This property is of type Color picker and can be referenced with the variable name label_color.

Color of the labels text.

Scale

This property is of type Floating point and can be referenced with the variable name label_scale.

Sets the basic size (text height) of the labels.

Follow Zoom

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

Whether labels get bigger and smaller when the panel is zoomed in and out.

Position

This property is of type Fixed list of ints and can be referenced with the variable name label_position.

Set the position of the label relative to the component.