# Send a signal to a bit in PLC with a write scripting bottom

**URL:** <https://forum.inductiveautomation.com/t/send-a-signal-to-a-bit-in-plc-with-a-write-scripting-bottom/99616>\
**Category:** Ignition\
**Created:** [December 10, 2024, 12:16am UTC](https://forum.inductiveautomation.com/t/send-a-signal-to-a-bit-in-plc-with-a-write-scripting-bottom/99616 "2024-12-10T00:16:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Flor\_Alejandra\_Trejo](https://avatars.discourse-cdn.com/v4/letter/f/e36b37/32.png) [@Flor\_Alejandra\_Trejo](https://forum.inductiveautomation.com/u/Flor_Alejandra_Trejo)\
**Post date:** [December 10, 2024, 12:16am UTC](https://forum.inductiveautomation.com/t/send-a-signal-to-a-bit-in-plc-with-a-write-scripting-bottom/99616/1 "2024-12-10T00:16:37Z")

</div>

Hello!  
currently I am working in an scripting to write values in the PLC when the bottom is pressed:

value = int(event.source.parent.getComponent('Column Number').text)  
value1 = int(event.source.parent.getComponent('Row Number').text)

if value \<= 12 and value \>0:  
system.tag.write('/Robots/HMI\_input\_column1', value)

if value1 \<= 11 and value1 \>0:  
system.tag.write('/Robots/HMI\_input\_row1', value1)

However, what I want is when these conditions are true and they were written in the PLC, another bit in my PLC goes high. Should I add another bottom attached to my 'write' bottom or it can be something handle from my current scrip?

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [December 10, 2024, 8:34am UTC](https://forum.inductiveautomation.com/t/send-a-signal-to-a-bit-in-plc-with-a-write-scripting-bottom/99616/2 "2024-12-10T08:34:41Z")

</div>

Welcome to the forum!

Please see [Wiki - how to post code on this forum](https://forum.inductiveautomation.com/t/wiki-how-to-post-code-on-this-forum/77831). You can edit your post to fix the code.

Add the 'vision' or 'perspective' tag so we know which application you are using.

I think you mean ' **button**', not 'bottom'.

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [December 10, 2024, 1:26pm UTC](https://forum.inductiveautomation.com/t/send-a-signal-to-a-bit-in-plc-with-a-write-scripting-bottom/99616/3 "2024-12-10T13:26:53Z")

</div>

It can be handled from your current script.

Your current script can be optimized. You didn't say explicitly that this was in Ignition 7, so I will assume that it is in Ignition 8+. In which case you should really be using the `system.tag.writeBlocking()` or `system.tag.writeAsync()` functions.

You should also be consolidating your writes into a single call. Even in Ignition 7 you should have preferred `system.tag.writeAll()` over multiple calls to `write()`.

Your tag paths do not appear to be valid paths as they do not start with a root folder. You should make sure that you use the tag selector in the script editor to get the correct path.

Your script should look something like this:

```python
columnNumber = int(event.source.parent.getComponent('Column Number').text)
rowNumber = int(event.source.parent.getComponent('Row Number').text)

if 0 < columnNumber <= 12 and 0 < rowNumber <= 11:
    system.tag.writeBlocking(['[default]parentPath/Robots/HMI_input_column1','[default]parentPath/Robots/HMI_input_row1','[default]path/to/boolean/bit'],[columnNumber,rowNumber,True])

```
