# Need some advice

**URL:** <https://forum.xod.io/t/need-some-advice/4365>\
**Category:** XOD Programming Questions\
**Created:** [August 28, 2020, 8:50am UTC](https://forum.xod.io/t/need-some-advice/4365 "2020-08-28T08:50:54Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![tgab101](https://avatars.discourse-cdn.com/v4/letter/t/7bcc69/32.png) [@tgab101](https://forum.xod.io/u/tgab101)\
**Post date:** [August 28, 2020, 8:50am UTC](https://forum.xod.io/t/need-some-advice/4365/1 "2020-08-28T08:50:54Z")

</div>

Hi  
first time trying to program I am trying to create a code to turn off and on my pump for my aquaponics, i managed to create the delays and the input timing, But i am stuck trying to figure out how to reset the loop once the last pump stops so the idea is as follow

1.start program  
2. delay 1 will count down for time specified by the settings  
3. once delay 1 is over, bolean = false - Pump timer node 1 will kick in the count down the time the pump need to be on  
4. once once pump timer on 1 is over, bolean = false - delay node will kick in the count down the time  
5. one delay 2 is over, bolean = false - Pump timer node 2 will kick in the count down the time the pump need to be on  
6. once pump timer 2 is false, delay 1 reset and the count down start again

in addition a noob question, how do i tell the program to start, i was thinking of putting a button to press so that it tell the program to go ahead

 ![code](https://canada1.discourse-cdn.com/flex027/uploads/xod/original/2X/9/9889153a6125f8f35c5493d022b8bca403800b8b.jpeg)

---

<div class="post-metadata">

**Author:** ![m-b](https://avatars.discourse-cdn.com/v4/letter/m/f14d63/32.png) [@m-b](https://forum.xod.io/u/m-b)\
**Post date:** [August 28, 2020, 2:52pm UTC](https://forum.xod.io/t/need-some-advice/4365/2 "2020-08-28T14:52:36Z")

</div>

Hi @tgab101

I have a similar solution for a pool pump, maybe it will give you a little bit of an incentive.  
It also depends on how everything is wired. It can be adjusted by the program or by the wiring.

 ![grafik](https://canada1.discourse-cdn.com/flex027/uploads/xod/original/2X/9/9e92bda664be90a7262bffc9ad169f4df7f305ec.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:** [August 28, 2020, 5:45pm UTC](https://forum.xod.io/t/need-some-advice/4365/3 "2020-08-28T17:45:03Z")

</div>

There are several other discussions on the forum about pump control, but yours seems to be much simpler than most of them. The way I read your description, you want 2 on-cycles with delay before each one, then repeat. That could just be 4 delay nodes with delay-ACT controlling pump (relay).

To restart the program, you need to loop the pulse back to the start of the program. Any time you loop back, you need a defer node. Since the program “starts” on boot (or replace that with button press), OR when it completes, you need an “any” node to allow more than one way to start.

NOTE: if you use button press to start program, button press (or output of “any” node) should be connected to 1st delay-SET and delay-RST on all other delay nodes to make sure there is only 1 pulse going through the system.

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

---

<div class="post-metadata">

**Author:** ![tgab101](https://avatars.discourse-cdn.com/v4/letter/t/7bcc69/32.png) [@tgab101](https://forum.xod.io/u/tgab101)\
**Post date:** [August 28, 2020, 11:33pm UTC](https://forum.xod.io/t/need-some-advice/4365/4 "2020-08-28T23:33:17Z")

</div>

Hi everyone,

Thanks so much. it is a simpler design than what i thought of. But when i test in simulation it does not work with the button. the cycle stop only at the first relay. not sure where i when wrong

 ![code 2](https://canada1.discourse-cdn.com/flex027/uploads/xod/original/2X/a/a27928349cdd3e724f8c24d918d412af6351d33d.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:** [August 29, 2020, 2:51am UTC](https://forum.xod.io/t/need-some-advice/4365/5 "2020-08-29T02:51:52Z")

</div>

Delay-DONE should link to next delay-SET, not delay-RST

---

<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:** [September 28, 2020, 2:51am UTC](https://forum.xod.io/t/need-some-advice/4365/6 "2020-09-28T02:51:58Z")

</div>

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