Newbee Delayed switch output

Freddy99:
Cool. Thanks.
Is there a best way to get around the problem people talk about with delays after 49 days ?

If you need only 1-second precision, store your times as seconds not milliseconds. Gets you about 68 years with signed 32-bit ints, twice as long unsigned. If you want millisecond precision for a stupid long time, use 64-bit numbers (long long):

unsigned long long now=0;
unsigned int lastms=0

void setup()
{
  lastms=millis();
  now=lastms;
}

void poll()
{
  unsigned int now32=millis();
  now+=now32-lastms;
  lastms=now32;

  // do other stuff...
}

It doesn't matter that millis() will overflow because you're always adding the difference of two subsequent calls to millis(), which (as long as your loop function doesn't take weeks!) will always be a small positive number despite the overflows. Of course, manipulating 64-bit ints in an AVR isn't real cheap, but it's much faster than floats!