The LED control allows digital outputs or internal firmware digital states to be viewed at runtime.
The LED control allows digital outputs or internal firmware digital states to be viewed at runtime. Any Boolean value on the schematic can be connected to the LED.
To use an LED, drag and drop it from the Virtuoso Components control group onto the schematic, or right-click the schematic area and type “LED” and select the LED from the drop-down.
The LED has a single IsOn Boolean input port. A ChangeLEDState event handler is available to toggle the LED’s value.
The LED’s properties are shown below.
The Component ID is generated randomly when the LED instance is created.
The On State Color specifies the color of the LED when it is on.
The LED Style specifies the visual style of the LED: either a photorealistic horizontal LED, as shown below:
The surface mount view appears as shown below.
The Simple LED option shows a very simple LED as shown below.
The Display Name is shown beneath the LED at runtime as shown below.
To easily see how the LED works, connect a knob to the LED as shown below. When you run the host, you will be able to control the LED by moving the knob. The port connection snippet metadata converts the knob’s double precision output to a Boolean by converting it to false if the value is exactly 0, and converting it to true if the value is greater than zero.
The XAML code emitted for the knob and LED for a C# WPF host are as shown below, with the data context for each binding to their respective view models.
The emitted base view model code regions are shown below. The knob and LED view model properties are declared
They are then initialized in the initialization section based on their configurations:
The port connection results in the Knob value’s change notification causing the LED value to be updated after being converted to a Boolean, as shown.