Do something, let time pass but no pause, do some

Is there some way I can take a reading from a sensor into a variable, let the program run for e.g. 2 seconds (i.e. no pause in the program), take a new reading into another variable and do some calculation based on those two values?

yes

Sure, that's a common requirement for doing lots of things. Load the digital example file from the Arduino IDE called blink without delay to see how you can build a non-blocking time delay using the millis() function.

Lefty

Thanks Lefty