apex programing question

Users Who Are Viewing This Thread (Total: 1, Members: 0, Guests: 1)

chanson

Active Member
View Badges
Joined
Dec 30, 2014
Messages
277
Reaction score
18
Location
thornton, co
Rating - 0%
0   0   0
Im trying to program button and switches to activate maintenance and feeding modes. Here is an example of a wave make im trying to do. I have them both working but my problem is that when I put the defer statement in it applies to both not just the momentary button. Is there a way that I can have it only defer for the button and the switch only be on and off?
Thanks

If but1 closed then off
Defer 005 then on
If sw1 closed then off
If sw1 open then on
 

SuncrestReef

That Apex guy
View Badges
Joined
Jan 18, 2018
Messages
4,214
Reaction score
9,217
Location
Oregon
Rating - 0%
0   0   0
Since Defer applies to the whole program, you need to create a separate virtual output to monitor the momentary switch and apply the Defer there. However, another issue is that a momentary button must remain pressed the whole time for the Defer to take effect, so a 2nd virtual output should be used to detect the initial press and release, while the other virtual output acts as the Defer timer. Then use the status of the Defer virtual output to control the powerhead

The example below would result in the powerhead turning off 5 minutes after pressing the button, then turning back on 1 minute later. (6 minute Min Time minus 5 minute Defer). Just adjust the times to your preference.

[vButton_Press] — virtual output 1 to detect the button press & release, but remain on for 6 minutes:
Set OFF
If but1 CLOSED Then ON
Min Time 006:00 Then ON

[vButton_Delay] — virtual output 2 to start the Defer timer for 5 minutes when the above output is on:
Set OFF
If Output vButton_Press ON Then ON
Defer 005:00 Then ON

[Powerhead]
Set ON
If sw1 CLOSED Then OFF
If Output vButton_Delay = ON Then OFF

If you’re not familiar with virtual outputs, see my tutorial here:
 
Last edited:
OP
OP
C

chanson

Active Member
View Badges
Joined
Dec 30, 2014
Messages
277
Reaction score
18
Location
thornton, co
Rating - 0%
0   0   0
Since Defer applies to the whole program, you need to create a separate virtual output to monitor the momentary switch and apply the Defer there. However, another issue is that a momentary button must remain pressed the whole time for the Defer to take effect, so a 2nd virtual output should be used to detect the initial press and release, while the other virtual output acts as the Defer timer. Then use the status of the Defer virtual output to control the powerhead

The example below would result in the powerhead turning off 5 minutes after pressing the button, then turning back on 1 minute later. (6 minute Min Time minus 5 minute Defer). Just adjust the times to your preference.

[vButton_Press] — virtual output 1 to detect the button press & release, but remain on for 6 minutes:
Set OFF
If but1 CLOSED Then ON
Min Time 006:00 Then ON

[vButton_Delay] — virtual output 2 to start the Defer timer for 5 minutes when the above output is on:
Set OFF
If Output vButton_Press ON Then ON
Defer 005:00 Then ON

[Powerhead]
Set ON
If sw1 CLOSED Then OFF
If Output vButton_Delay = ON Then OFF

If you’re not familiar with virtual outputs, see my tutorial here:
Thanks, but I still cant get it to work

Screenshot_20201019-104059_APEX Fusion.jpg Screenshot_20201019-103959_APEX Fusion.jpg Screenshot_20201019-103929_APEX Fusion.jpg
 

SuncrestReef

That Apex guy
View Badges
Joined
Jan 18, 2018
Messages
4,214
Reaction score
9,217
Location
Oregon
Rating - 0%
0   0   0
The Defer time and the Min Time values cannot be the same because they will both expire at the same time and cancel the operation. My example above had Min Time set to 1 minute longer than the Defer time.
 

SuncrestReef

That Apex guy
View Badges
Joined
Jan 18, 2018
Messages
4,214
Reaction score
9,217
Location
Oregon
Rating - 0%
0   0   0
Here's a way to visualize what it's doing:

Screen Shot 2020-10-19 at 10.04.02 AM.png
 
OP
OP
C

chanson

Active Member
View Badges
Joined
Dec 30, 2014
Messages
277
Reaction score
18
Location
thornton, co
Rating - 0%
0   0   0
That worked. So is the a way to have it shut off as soon as you hit the button and then turn back on after a set amount of time? Thanks
 

Reefing threads: Do you wear gear from reef brands?

  • I wear reef gear everywhere.

    Votes: 18 14.1%
  • I wear reef gear primarily at fish events and my LFS.

    Votes: 9 7.0%
  • I wear reef gear primarily for water changes and tank maintenance.

    Votes: 1 0.8%
  • I wear reef gear primarily to relax where I live.

    Votes: 19 14.8%
  • I don’t wear gear from reef brands.

    Votes: 72 56.3%
  • Other.

    Votes: 9 7.0%
Back
Top