# Reading OPC Tag Value

**URL:** <https://forum.inductiveautomation.com/t/reading-opc-tag-value/68436>\
**Category:** Ignition\
**Tags:** scripting\
**Created:** [January 10, 2023, 4:27pm UTC](https://forum.inductiveautomation.com/t/reading-opc-tag-value/68436 "2023-01-10T16:27:02Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pedro\_Oliveira](https://avatars.discourse-cdn.com/v4/letter/p/43a26b/32.png) [@Pedro\_Oliveira](https://forum.inductiveautomation.com/u/Pedro_Oliveira)\
**Post date:** [January 10, 2023, 4:27pm UTC](https://forum.inductiveautomation.com/t/reading-opc-tag-value/68436/1 "2023-01-10T16:27:02Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![mdia](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mdia/32/87599_2.png) [@mdia](https://forum.inductiveautomation.com/u/mdia)\
**Post date:** [January 10, 2023, 4:41pm UTC](https://forum.inductiveautomation.com/t/reading-opc-tag-value/68436/2 "2023-01-10T16:41:16Z")

</div>

The tag read function is wrong, it should be

```auto
system.tag.read("[Default[Motor]").value

```
