Hi, so i created a button in which it changes an OPC Tag value (Boolean) to 1 when pressed down and it turns the same Tag value to 0 when stopped pressed.
Then i created, in the same button a DoubleClick Action that changes the value to 1.
For more context, it is a motor then it can be activated for as long as the user is pressing the button, but can be activated indefinitely if double clicked.
Now, I have another Tag that is called "Sensor" (Boolean OPC) and when this sensor is at 1 the motor can work but if it turns 0 it has to stop.
I want to do something similar to this:
if system.tag.read ("[Default]Motor", "value") == 1:
system.tag.write("[Default]Motor", 1)
else:
system.tag.write ("[Default]Motor", 0)
I code above is wrong and I realize that system.tag.read does not work. It is just to give a general idea. I tried a lot of different ways, but cant seem to find de code/function to read the OPC Tag value of the Sensor and act accordingly with that value.
If any can help, i would be thankful.
The tag read function is wrong, it should be
system.tag.read("[Default[Motor]").value
2 Likes