I want to ask the maximum value for delay node.
The idea is i want to turn on DC motor for x minutes then turn off for x hour
the easiest way crossed in my mind is using delay. already try for small value and it work. can someone tell me the maximum value the delay node can handle
It can be “Timer”, compare the value until it is exceeded, execute the task and reset the timer when you want
do i need RTC module to work with timer node?
do you have example how timer node work?
this patch can simulate it without board and see the results
instead of using
equal, you can use
If I remember correctly, Arduino system time (millis) will loop after about 6 days. Timer node keeps a running count of seconds, but I think the 1st update after timer roll-over will “add” -max_seconds to the cumulative time, causing problems for your program once a week. Timer node should check for negative time elapsed & either add value to max time to get real time, or at least ignore the one update cycle.
Yes, I missed that, but as he says turn on a few minutes and turn off hours I think it should work. Likewise, my experience with RTC was somewhat similar in advance in a matter of weeks, I would have to go to a RTC of precision
The problem with the timer bug is that sios’ program will probably be waiting for x hours when the system time rolls over, and timer will suddenly show it has been running for negative 5+ days, so timer will not trigger after x hours and program will appear hung.
His program could check for negative timer value and either assume x hours have passed, or restart x hour timer depending on which causes less grief for his application (once a week your action runs twice with <x hour delay, or once a week it waits up to 2x time before performing action).
Fixing the timer node would be the best option. The quick fix is to update lastUpdateTime, but not output_OUT if dtSeconds is negative. This causes its own problems, but affect would be minimal for short UPD periods.
what do you think of something like that? I could have used greater-equal but as a whole use equal
in my understanding the timer has bug and it’s not possible to use in my case. CMIIW
to be precise what i’m about to do is running motor for 2min and paused it for 4 hour and loop for eternity and im looking for the simplest way no RTC if possible since there is not enough space for it >.<
and the simplest way is using delay, but is it possible to pause for 4h (14400s)?
if this works for you, change 12 x 120 and 144 x 14400
FYI: the flip-flop in the above patch is not necessary since it is always the value of delay-ACT. The two any nodes will pulse at the same time, so you could feed both pins from one instead of having both.
In general, it is a good idea to use greater-or-equal instead of just equal. Since XOD is using floating point numbers, it is possible (though probably unlikely in this case) for count to end up being 14399.9999, then incr to 14400.9999 or some similar non-integer value. This would be more likely to happen if you were using count-STEP of 1/60 to count minutes instead of seconds (or 1/3600 to count hours…).
The flip-flop was there because at first I planned to deactivate it with a pulse on the other side of the program. But then I realized that I did not need more time than the delay and deactivated it with Done, it happened to me … it will be that I was half asleep
I left dumber mistakes than that in my advanced traffic signal tutorial to show that programming is often a series of dead-ends before the light comes on and you come up with a nice solution…I didn’t even have the excuse that I was half-asleep when I came up with some of my dumb ideas