Calculating delta time

On an Arduino floating point maths is very slow as is integer division. They should be avoided if at all possible if performance matters.

If you can organize the maths so that divisions can be by values which are a power of 2 (e.g. 2, 4. 8. 16 etc) you can use the right shift instruction. For example >> 6 shifts the value to the right by 6 places which is equivalent to dividing by 64 (26 = 64) and that instruction is very fast.

...R