# Convert constant input to pulse

**URL:** <https://forum.xod.io/t/convert-constant-input-to-pulse/5254>\
**Category:** XOD Programming Questions\
**Created:** [June 9, 2021, 8:43am UTC](https://forum.xod.io/t/convert-constant-input-to-pulse/5254 "2021-06-09T08:43:14Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![mvpolo2k3](https://avatars.discourse-cdn.com/v4/letter/m/8edcca/32.png) [@mvpolo2k3](https://forum.xod.io/u/mvpolo2k3)\
**Post date:** [June 9, 2021, 8:43am UTC](https://forum.xod.io/t/convert-constant-input-to-pulse/5254/1 "2021-06-09T08:43:15Z")

</div>

Trying to convert a toggle input to a true pulse and a false pulse. Ive tried flip flops, if-else, and everything else I can think of. Basically I have a pressure switch, and I need to it output a .5 second pulse when it opens to one port, and a .5 second pulse to a different port when it closes. I have a 20hp rotary compressor that doesnt run in “auto” mode anymore, and you have to hit start and stop manually, which is terribly inefficient. I need a way to use the pressure switch which is a close/open contact to work as a digital input, and simulate the bottons being pushed via a 2ch relay board that will be tied to the control panel.

Maybe Im missing something, but everything Ive tried just doesnt work or works in the wrong fashion. Any help is greatly appreciated!!!

---

<div class="post-metadata">

**Author:** ![mvpolo2k3](https://avatars.discourse-cdn.com/v4/letter/m/8edcca/32.png) [@mvpolo2k3](https://forum.xod.io/u/mvpolo2k3)\
**Post date:** [June 9, 2021, 9:15am UTC](https://forum.xod.io/t/convert-constant-input-to-pulse/5254/2 "2021-06-09T09:15:29Z")

</div>

this is what i have so far, and it seems to be working ok

 ![NnIcrG1suX](https://canada1.discourse-cdn.com/flex027/uploads/xod/original/2X/b/bea70b3a7faf41ee47eb8c22de5776543bc03dc7.png)

---

<div class="post-metadata">

**Author:** ![danya](https://avatars.discourse-cdn.com/v4/letter/d/7ba0ec/32.png) [@danya](https://forum.xod.io/u/danya)\
**Post date:** [June 9, 2021, 3:00pm UTC](https://forum.xod.io/t/convert-constant-input-to-pulse/5254/3 "2021-06-09T15:00:29Z")

</div>

Do I understand correctly that the picture below works the same?

 ![image](https://canada1.discourse-cdn.com/flex027/uploads/xod/original/2X/f/fa34832e8ac2545a2360e9d858eadf3da5290f7a.png)

---

<div class="post-metadata">

**Author:** ![gweimer](https://avatars.discourse-cdn.com/v4/letter/g/a9adbd/32.png) [@gweimer](https://forum.xod.io/u/gweimer)\
**Post date:** [June 9, 2021, 9:23pm UTC](https://forum.xod.io/t/convert-constant-input-to-pulse/5254/4 "2021-06-09T21:23:27Z")

</div>

Should be the same. If you want to be more explicit, you could use pulse-on-true and pulse-on-false to feed the ‘delay’ nodes (but that shouldn’t change functionality). You might even be able to use output of pulse-on-true & pulse-on-false directly, but I doubt they would be “high” long enough for this application, so delay nodes are probably needed.

---

<div class="post-metadata">

**Author:** ![mvpolo2k3](https://avatars.discourse-cdn.com/v4/letter/m/8edcca/32.png) [@mvpolo2k3](https://forum.xod.io/u/mvpolo2k3)\
**Post date:** [June 9, 2021, 11:11pm UTC](https://forum.xod.io/t/convert-constant-input-to-pulse/5254/5 "2021-06-09T23:11:19Z")

</div>

WOW, that worked exactly as my MUCH longer version. Thanks!!! I guess I was over complicating it a bit.

---

<div class="post-metadata">

**Author:** ![mvpolo2k3](https://avatars.discourse-cdn.com/v4/letter/m/8edcca/32.png) [@mvpolo2k3](https://forum.xod.io/u/mvpolo2k3)\
**Post date:** [June 9, 2021, 11:12pm UTC](https://forum.xod.io/t/convert-constant-input-to-pulse/5254/6 "2021-06-09T23:12:43Z")

</div>

yeah, I need at least a .25 second pulse to trigger the button on the controls. the only issue I have now is the relay board is a low trigger, so i need to add some pull up resistors and another not gate to invert the output of the Nano

---

<div class="post-metadata">

**Author:** ![mvpolo2k3](https://avatars.discourse-cdn.com/v4/letter/m/8edcca/32.png) [@mvpolo2k3](https://forum.xod.io/u/mvpolo2k3)\
**Post date:** [June 10, 2021, 9:29am UTC](https://forum.xod.io/t/convert-constant-input-to-pulse/5254/7 "2021-06-10T09:29:32Z")

</div>

so this is where I am at right now. for some odd reason with the other setup, sometimes it would pulse both outputs at the same time, and sometimes it wouldnt pulse at all, which i think was a weird debounce/delay issue. this seems to work 100%

 ![qk07yfhX17](https://canada1.discourse-cdn.com/flex027/uploads/xod/original/2X/c/ce717fafeb7765ab9e6c4a82708ed937ec180dba.png)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex027/uploads/xod/original/1X/eb7348baa04192c2ef932d1db54d44f09f8a7888.png) [@system](https://forum.xod.io/u/system)\
**Post date:** [July 10, 2021, 9:30am UTC](https://forum.xod.io/t/convert-constant-input-to-pulse/5254/8 "2021-07-10T09:30:25Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
