# Best way to turn boolean tag value high every 5 seconds?

**URL:** <https://forum.inductiveautomation.com/t/best-way-to-turn-boolean-tag-value-high-every-5-seconds/50123>\
**Category:** Ignition\
**Created:** [August 19, 2021, 8:05pm UTC](https://forum.inductiveautomation.com/t/best-way-to-turn-boolean-tag-value-high-every-5-seconds/50123 "2021-08-19T20:05:20Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![leonardo.godoi](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/leonardo.godoi/32/27178_2.png) [@leonardo.godoi](https://forum.inductiveautomation.com/u/leonardo.godoi)\
**Post date:** [August 19, 2021, 8:52pm UTC](https://forum.inductiveautomation.com/t/best-way-to-turn-boolean-tag-value-high-every-5-seconds/50123/4 "2021-08-19T20:52:16Z")

</div>

Handshake issues asside, i'm not sure this is the most efficient way but in your place i would do the following:

- Create a Timer Gateway Event, configure it with a delay of 5000(ms) with fixed delay and shared threading.

- Use the following script:

```auto
#Read the tag value.
#readBlocking requires you to use a list of tags to read and
#returns a qualified value.
#A list containing only the tag we want to read is passed
#to the function and then
#we look into the .value part of the qualified value from the 
#first and only returned item
myTag = system.tag.readBlocking(['TagAddressHere'])[0].value

if myTag == False:
	#Write only if the Tag is False.
	#If your tag is True for too long, the alarm should detect it.
	#Similar to readBlocking, writeBlocking needs you to provide
	#a list of tag paths to write to along with a list of values to
	#write to each address
	system.tag.writeBlocking(['TagAddressHere'],[True])

```

- Then, on your heartbeat tag, create the following alarm:  
 ![java_SaNqb0o9h1](https://us1.discourse-cdn.com/inductiveautomation/original/3X/9/b/9b63e127b06b833d51e9d2907e7f993141c661e2.png)

The Equal mode with a setpoint of 1 will monitor when your tag is True to turn on the alarm but with the Active delay set to 15, it should wait 15 seconds before actually activating the alarm.

I hope this helps!

---

_[View the full topic](https://forum.inductiveautomation.com/t/best-way-to-turn-boolean-tag-value-high-every-5-seconds/50123)._
