Apex Code keeps turning plug to off position

Digicop

Community Member
View Badges
Joined
Feb 4, 2020
Messages
99
Reaction score
42
Location
Rayne, LA
Rating - 0%
0   0   0
After the script runes the first time it turns off the plug instead of leaving it in AUTO, so the script will not run again.

The code reads:

Fallback OFF
Set OFF
If Output ReturnPump = OFF then OFF
When On > 005:00 Then Off
Defer 002:00 Then On
If Sw1 OPEN then ON
If pH < 8.30 then ON
If pH > 8.35 then OFF
If Sw1 CLOSED then OFF
If Sw1 OPEN then ON

Any help would be appreciated.

Ricky
 

All_talk

Active Member
View Badges
Joined
Oct 8, 2019
Messages
398
Reaction score
368
Location
Thorp, WA
Rating - 0%
0   0   0
Its the "When" statement, its doing exactly what its designed to do...


What are you trying to do/control?
 

Zayne

Community Member
View Badges
Joined
Mar 20, 2020
Messages
42
Reaction score
15
Rating - 0%
0   0   0
Whatever it's for is staying on longer that 5 minutes and the When is moving it to off. You may need to increase the timing if it's expexcted to be on longer, or see what hitting 5 minutes if its not.
 

David_CO

Active Member
View Badges
Joined
Feb 15, 2022
Messages
366
Reaction score
229
Location
Colorado
Rating - 100%
1   0   0
in general you have some funky logic in there. you have the SW1 on statement twice.....i assume you just want the pump off if the switch is closed, if so just include the closed statement.

I dont think you need "set off"


Trying to deduct what you're trying to do here......
you want to turn of a pump on that feeds kalk when your PH is below a certain threshold and turn it off when above.
SW1 is presumably a level sensor in your kalk container so the pump doesnt run when dry
when the pump is on 5 mins you want it to turn off for 2 mins.....I dont believe apex code works this way.

I would use OSC commands and have lines around whether its on or off based on PH and fluid level below that. It might be possible to do some permutation of this and make it work but OSC is going to be alot more straight forward.
 
Last edited:

TOP 10 Trending Threads

HOW DO YOU ADJUST YOUR CUC AS ALGAE DISAPPEARS?

  • Capture and re-home CUC

    Votes: 8 7.2%
  • Increase white light/hours in tank to spur algae growth to feed CUC

    Votes: 7 6.3%
  • Feed nori to support CUC

    Votes: 39 35.1%
  • Feed herbivore pellets to support CUC

    Votes: 39 35.1%
  • Allow attrition to balance CUC and algae

    Votes: 47 42.3%
  • Provide macro algae to feed CUC

    Votes: 8 7.2%
  • Introduce CUC predators

    Votes: 1 0.9%
  • Other (please explain)

    Votes: 11 9.9%
Back
Top