Hi everyone. I wanted to start a thread on the usage of the TimedPort class. This is essentially a Class to define a Relay with some properties. Right now it's similar to the DosingPumpRepeat function but with additional features. Here are some examples of things you could do

1. Have a defined runtime, offset, delay (like DelayedPort), repeat - Easy stuff2. Have a defined StartTime and StopTime (say you want to shut off a pump but only for 10 minutes...) or you want to manually trigger a relay but only want it to run for 5 minutes (when it's normal programming is for 20)3. Pause/Resume4. Load/Save settings to/from memory

In the future, I would like to extend this class to a DosingPump class so that it could have parameters like Volume, and Rate and Calibration.

Now for me, this pump is the mixing pump for my saltwater station so when I do a new batch of salt, I want it to run for 12 hours, not the usual 60. I don't want to have to remember to turn it off 12 hours later... so we can do something like this:

So now the pump will be disabled for 15 minutes based on the StopTime I have set. This is great if you want to turn off your skimmer because you glued some frags and don't want to forget to turn it back on for instance.

Now, the Run() command I mentioned earlier is only needed for managing the timed operations for start/stop and to auto run the schedule. You can also use this without using Run by using the normal Relay commands.

mainPump.On();mainPump.Off();mainPump.DelayedOn();

and another usage that is nice is Osc. Osc is similar to the Apex usage.

mainPump.Osc(0,60,60,true);

This will run with 0 offset, for 60 minutes on then 60 minutes off, and true for ON. This is actually called by the Run() command along with the other timer monitoring.

There is more commands that I did not discuss, but most are self explanatory, such as the following.

Can you post some full code of this in use?I know you broke out different sections, but seeing a larger/complete code inside the loop() will help me get a better understanding of how you intended the functions to be called. (you don't need to include your entire loop(), just the relevant parts related to using this class).

so this was from my water mixing station. The main pump would basically run every other hour. If I started it manually, then it would run for 6 hours, and if I stopped the pump, it would stay off for 15 minutes then resume normal operation.

You could set the Time and Repeat to 0 and it would only run for the StartTime / StopTime when you override on or off respectively. So if you wanted something to run on demand for 10 minutes... or if you want your reactor to go off for half an hour while you change the media or something.

If you wanted the settings to be seconds, you could set the Scale to 1, if you wanted it in hours, you could set Scale to 3600. Them Time=1 would be one hour (or 3600 seconds)

I've been working on extending this class for a DosingPump class extending this class. One thing I noticed was that the StartTime and StopTime were INT variables and not double's. This "can" pose a problem if you have a runtime in seconds greater than 9 hours. This "should" not ever occur BUT it's possible that it would.I'm going to tweak it in my code base for testing and will be able to push the changes to the main branch once tested in the future.

Cool, glad to see it used Yeah, that's probably a good catch. I don't know if my issue, but I know there was a bug somewhere. Plus I was using it for controlling a mixing pump so I was definitely working with values up to and over 12 hours at a time...

lnevo wrote:Cool, glad to see it used Yeah, that's probably a good catch. I don't know if my issue, but I know there was a bug somewhere. Plus I was using it for controlling a mixing pump so I was definitely working with values up to and over 12 hours at a time...

well, the issue would be if you were using seconds for the scale and trying to go beyond 9 hours (actually 9.1 or more hours....rounded).