Associate the LED color with the spin box

Control the color of the LED object by changing spin box values at runtime.
  1. In
    Project view
    , select
    LED1
    .
  2. In
    Properties
    , create a complex dynamic link with a
    Key-value converter
    between the
    Color
    and
    Value
    of
    SpinBox1
    :
    Source Dynamic link
    ProjectName
    UI
    Pages
    Page1 (type)
    SpinBox1
    Value
    .
    For more information about dynamic links, see Create dynamic links.
  3. In
    Complex dynamic link editor
    , next to
    Key-value converter
    , select
    Edit
    .
    For more information, see Key-value converter.
    ValueMap editor
    displays in the central pane.
  4. In
    ValueMap editor
    , next to
    Values
    , select
    String
    and select
    Color
    .
    TIP: If you do not see the required option, select the
    Show all
    checkbox.
  5. Add two rows by selecting
    Add
    two times.
  6. Set the values as follows:
    Keys (UInt32)
    Values (Color)
    0
    #cd163f
    1
    #f58025
    2
    #00aeef
  7. In
    Project view
    , select
    SpinBox1
    .
  8. In
    Properties
    , set
    Minimum value
    to
    0
    .
    TIP: Setting
    Minimum value
    prevents you from providing values that are not handled by
    Key-value converter
    at runtime.
  9. In
    Properties
    , set
    Maximum value
    to
    2
    .
    TIP: Setting
    Maximum value
    prevents you from providing values that are not handled by
    Key-value converter
    at runtime.
Changing LED color
Provide Feedback
Have questions or feedback about this documentation? Please submit your feedback here.