help with variable?

Sorry, my mistake. I gave you code for how long each loop took, not cumulative time since start.

In setup(), do this:

lastMillis=millis();

This will be done just once.

Then in loop(), remove all of these:

lastMillis = nowMillis;

Ray