# Momentary button in Perspective

**URL:** <https://forum.inductiveautomation.com/t/momentary-button-in-perspective/79909>\
**Category:** Ignition\
**Tags:** vision, ignition81, perspective\
**Created:** [October 2, 2023, 8:08am UTC](https://forum.inductiveautomation.com/t/momentary-button-in-perspective/79909 "2023-10-02T08:08:37Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pyrak](https://avatars.discourse-cdn.com/v4/letter/p/e0b2c6/32.png) [@Pyrak](https://forum.inductiveautomation.com/u/Pyrak)\
**Post date:** [October 2, 2023, 8:08am UTC](https://forum.inductiveautomation.com/t/momentary-button-in-perspective/79909/1 "2023-10-02T08:08:37Z")

</div>

Hello Everyone,  
I did a project in Vision that controlled a PLC that could work in both auto and manual modes. For the next button implementation (during manual operation) in Vision, I used a momentary switch. I want to work on the same project in Perspective but I'm having a hard time figuring out how to implement the operation of the next button in perspective. I will highly appreciate detailed guidance on how to go about it.

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [October 2, 2023, 8:48am UTC](https://forum.inductiveautomation.com/t/momentary-button-in-perspective/79909/2 "2023-10-02T08:48:59Z")

</div>

Hello,

There's a reason there's no built-in momentary button. It's been discussed countless times:  
[https://forum.inductiveautomation.com/search?q=momentary%20button%20perspective](https://forum.inductiveautomation.com/search?q=momentary%20button%20perspective)

Try and get the habit of using the search tool before asking something that's been answered before, you'll find information faster, and we won't have to repeat what's been said already.

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [October 2, 2023, 9:26pm UTC](https://forum.inductiveautomation.com/t/momentary-button-in-perspective/79909/3 "2023-10-02T21:26:54Z")

</div>

> [@Pyrak](#):
>
> figuring out how to implement the operation of the next button in perspective

It's not clear to me what the next button does. Is it truly a jog button? ...because that's what we're imagining when we read momentary switch, and it's the jog button that's problematic to use from a web browser.

---

<div class="post-metadata">

**Author:** ![Pyrak](https://avatars.discourse-cdn.com/v4/letter/p/e0b2c6/32.png) [@Pyrak](https://forum.inductiveautomation.com/u/Pyrak)\
**Post date:** [October 3, 2023, 9:48am UTC](https://forum.inductiveautomation.com/t/momentary-button-in-perspective/79909/4 "2023-10-03T09:48:38Z")

</div>

> [@justinedwards.jle](#):
>
> we read momentary switch,

Each time the button is pressed, counter value (CTU) increases leading to the activation of the next step of a a sequential operation.

---

<div class="post-metadata">

**Author:** ![Hayden\_Watson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/hayden_watson/32/48792_2.png) [@Hayden\_Watson](https://forum.inductiveautomation.com/u/Hayden_Watson)\
**Post date:** [October 3, 2023, 9:55am UTC](https://forum.inductiveautomation.com/t/momentary-button-in-perspective/79909/5 "2023-10-03T09:55:34Z")

</div>

> [@Pyrak](#):
>
> activation of the next step of a a sequential operation.

Maybe a bit risky if using perspective. Your browser deciding to crash etc. while running these operations isn't an insignificant risk

How many steps are there on average, would it be a terrible idea to just have a button incremement by one each time it's pressed?

---

<div class="post-metadata">

**Author:** ![Pyrak](https://avatars.discourse-cdn.com/v4/letter/p/e0b2c6/32.png) [@Pyrak](https://forum.inductiveautomation.com/u/Pyrak)\
**Post date:** [October 3, 2023, 1:45pm UTC](https://forum.inductiveautomation.com/t/momentary-button-in-perspective/79909/6 "2023-10-03T13:45:20Z")

</div>

> [@Hayden\_Watson](#):
>
> How many steps are there on average, would it be a terrible idea to just have a button incremement by one each time it's pressed?

There are approximately 28 steps. My aim was to bind the button to that PLC tag so that the CTU can do the count. I have no idea how to increment the value with a button then pass it to the PLC.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [October 3, 2023, 2:11pm UTC](https://forum.inductiveautomation.com/t/momentary-button-in-perspective/79909/7 "2023-10-03T14:11:32Z")

</div>

> [@Pyrak](#):
>
> I have no idea

Use a simple integer tag instead of a counter. Subscribe to that tag in Ignition (drag it from the OPC browser, whatever). You probably want it anyways to display what state you are in.

In your button, **bidirectionally** bind that tag to a **custom** property. Then you can do arithmetic and/or assign to it in scripts with natural syntax. In Perspective, your button's action performed event script would look like this:

```auto
def .....
	self.custom.someProp += 1

```

In Vision, like this:

```auto
event.source.someProp += 1

```

You should also bind your button's enable property so that it cannot act when the sequence is complete or interlocks have it on hold.

---

<div class="post-metadata">

**Author:** ![jlandwerlen](https://avatars.discourse-cdn.com/v4/letter/j/bc8723/32.png) [@jlandwerlen](https://forum.inductiveautomation.com/u/jlandwerlen)\
**Post date:** [October 3, 2023, 2:12pm UTC](https://forum.inductiveautomation.com/t/momentary-button-in-perspective/79909/8 "2023-10-03T14:12:15Z")

</div>

> [@Pyrak](#):
>
> Each time the button is pressed, counter value (CTU) increases leading to the activation of the next step of a a sequential operation.

That doesn't sound like a reason to need a momentary button, just use a regular button. Let the PLC reset the command sent from the HMI.

---

<div class="post-metadata">

**Author:** ![Hayden\_Watson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/hayden_watson/32/48792_2.png) [@Hayden\_Watson](https://forum.inductiveautomation.com/u/Hayden_Watson)\
**Post date:** [October 3, 2023, 2:24pm UTC](https://forum.inductiveautomation.com/t/momentary-button-in-perspective/79909/9 "2023-10-03T14:24:48Z")

</div>

I think the point of a momentary button would be if you need to halt the operation at a moments notice by releasing your finger, which in something like a browser isn't very reliable.

Hence either increment like Phil suggests with a button, or just have a start operation and stop operation button and let the PLC do the heavy lifting
