Recommended Posts

I am trying to simulate an LED component that can change color to indicate a status, like a traffic light.

I need 4 different colors

1. Some dark color to indicate OFF - it does not matter which color
2. RED
3. Yellow
4 Green

I know the normal LED component cannot do this, but there must be some way to simulate it.

I need to change the color from a sequence.


I am using DAQFactory Pro Release 17.1 Build 2309


Link to comment
Share on other sites

There are several ways.  First, you could use a symbol component.  Create 4 rows, one for each color.  Then in Symbol Factory find an LED symbol you like, change it to the various colors, and paste each into a row.  Give each row a different threshold, say 0, 1, 2 and 3.  Then assign a variable to the Expression.  Then when you change the value of the variable, the different symbol will be displayed.

You can also do it from script by changing the background color of a symbol component, or even a panel component.  But then it will be a square LED.  For a more shaped LED, you need to use the method above.

You also could do it using two LED components on top of each other, one that does state 1 and 2, and the other that does 3 and 4.  Then in script make it so only one of the LED's are visible.  If you wanted to reuse this, you could group the components and do everything through the group.

Link to comment
Share on other sites

OK, great. I like the sound of the last option, using two LED components on top of each other.

However I am very new to DAQFactory and have no idea how I can make one LED visible while hiding the other ?

Any help would be appreciated


Link to comment
Share on other sites

  • 2 weeks later...

Actually, the quickest way is to display the Event panel (View->Events), select each LED, then select the OnPaint event.  Let's say the variable is called myVar, and the first LED shows state 0 and 1, and the second 2 and 3.  So, the On Paint event for the first LED would be:

visible = myVar < 2

while the second LED would be:

visible = myVar > 1


Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.