Page 1 of 1

Programme

Posted: Wed Sep 16, 2015 3:47 am
by Jeannot
Hi
In the example found in: http: //www.megunolink.com/documentation/plotti ... reference/ I do not understand why the statement: LastSent = millis (); on line 16 is repeated on line 28?

Jeannot

Re: Programme

Posted: Sat Sep 19, 2015 4:20 am
by philr
Hi, the first in the Setup function just initializes LastSent with a sensible value. The loop function is continuously called and after 200mS (SendInterval) the if statement is executed. LastSent is set again to the current time so the if statement doesn't execute again until 200mS later. If it was not set the if statement would continue to run every time around the loop, not ever 200mS.

Cheers
Phil