in data 05-27-2019 10:12 AM
I'm trying to do something very simple, I'd like to change the value of a LED in the Dashboard every ten seconds but I have no clue how to use the Python scripting event to do this. Could you help me please.
Risolto Andare alla soluzione.
in data 05-28-2019 10:08 AM
Hello, what are you trying to do ?
Why did you not use LabVIEW?
in data
05-28-2019
11:12 AM
- data ultima modifica
12-09-2025
01:59 PM
autore
Content Cleaner
Hi,
The attached dashboard features an LED that is triggered to change value every second using a timer event script.
The manual (https://www.ni.com/documentation/en/systemlink/latest/data/adding-event-scripts-to-widgets/) text falls a bit short.
The python code below is added to an led widget with label "led1". Every time the timer event trigger the function testLED is called with the widget name as argument. The biggest issue is that the LED property page shows the property name, which is spot on for "Off label" and "On label", but not for "value". This property name is all lower case, but it doesn't seem to be described anywhere. (accidentally stumbled on this while reviewing the raw content of the exported fp file).
def testLED(widget_name): currentValue = get_widget_prop(widget_name, 'value') newValue = not currentValue set_widget_prop(widget_name, 'Off label', 'False') set_widget_prop(widget_name, 'On label', 'True') set_widget_prop(widget_name, 'value', newValue)
Unzip the file and import into SystmLink (V19.0) (@NI: Please add .fp to allowed file extensions)
in data 05-29-2019 03:40 AM
Thank you so much, do we have to use ' ' every time we want to change the value ?, also can we add conditions or loops? And what if we want tu update our value depending on some other widget?
in data 05-29-2019 06:02 AM
You can do a lot as long as it's supported by Python within the scope of the defined function.
You can create variables that hold the constant values and use those, e.g.
Param = 'value'
This variable can then be used instead of the constant string. I only did it this way to clearly show which value is taken from which place.
in data 06-04-2019 04:17 AM
I've been trying to use python scripts with 'Binding Updated' but it doesn't work. I don't know what I'm doing wrong
in data 01-23-2020 07:02 AM