Hello,
correcting the constraints didn't work. When I came back from work, I noticed the Arduino crashed after 4 hours and 40 minutes.
The free RAM functions tell me I have 1500 bytes of RAM available after startup, so no problems there.
PaulS: Thank you for your comments. Maybe you're right about clueless. But hopeless is maybe a better word. ![]()
I've checked my code so many times now, and I really don't see where I would violate my array bounds. So I removed the constrains.
Adding time variables is a bad idea.
Aha! A bad idea I didn't code myself! That piece of code comes from the PID Library Relay Output Example
I've changed
if(curMillis - windowStartTime>windowSize) windowStartTime += windowSize;
if(Output >= curMillis - windowStartTime) digitalWrite(RELAYPIN,HIGH);
else digitalWrite(RELAYPIN,LOW);
to
if(curMillis - windowStartTime>=windowSize) windowStartTime = curMillis;
if(Output > curMillis - windowStartTime) digitalWrite(RELAYPIN,HIGH);
else digitalWrite(RELAYPIN,LOW);
Would that be allright?
I've updated my code above, formatted (thanks for the tip) and restored functions / added more comment.
Wouter