3 ms·
What is the code trying to do? Sweep left (food starts falling), wait on average 90 sec (food gone?), sweep right, wait 85ms. Then does it stop, or repeat the
by Tempest1981 10y ago
What is the code trying to do?
Sweep left (food starts falling), wait on average 90 sec (food gone?), sweep right, wait 85ms.
Then does it stop, or repeat the loop (until the outlet timer turns it off)?
- rrauenza 10y agoI think left is closed. So it starts by issuing the close command, waiting a random amount of time, opening, delaying 85ms, then restarting the loop by closing. The random sleep seems unusual, though -- I would have normally done delay(random(1802) 1000) -- is this a particular idiom with a benefit I don't know about?
- Tempest1981 10y agoSo the intent is an 85 ms burst of food, every couple of minutes -- that makes more sense. The initial "close" threw me. Is the door initially open? Or are we just jamming it shut and stressing the servo?
- rrauenza 10y agoI assumed it was some kind of fail safe... Always start the loop in the closed position. In case the Arduino got reset mid cycle...
- Tempest1981 10y agoI wonder how often power shuts off during the delay(85 ms) time window. Statistically maybe a 1 out of 1000 chance. Probably more likely to shut off while opening/closing the door -- in those 2 loops (2 out of 1000?). Assuming an average main loop of ~85 seconds. Kitty jackpot!
- pweissbrod 10y agoIt repeats the loop from the top