/// we use prevMsec rather than nextMsec because it is easier to handle the uint32 rollover in that case, also changes in periodMsec take effect immediately
uint32_tprevMsec;
public:
uint32_tperiodMsec;
virtual~PeriodicTask(){}
PeriodicTask(uint32_tperiod):periodMsec(period)
{
prevMsec=millis();
}
/// call this from loop
virtualvoidloop()
{
uint32_tnow=millis();
if(now>(prevMsec+periodMsec))
{
// FIXME, this lets period slightly drift based on scheduling - not sure if that is always good