Speed Sensor (Velocity Km/H) Using Ultrasonic Sensor (Ping)

can u show me the example from my coding?

long duration, inches, cm, currentState, previousState;

AWOL:
Any variable declared within a function like "loop" is going to have limited use for remembering its value.
If you want a variable to maintain its value, declare it with global scope.

I thought declaring a variable static solves any 'memory' problem for variables declared within the scope of a function?

Lefty

These variables aren't declared static in the routine though

I thought declaring a variable static solves any 'memory' problem for variables declared within the scope of a function?

It does - I just suggested global scope because it is what most noobs are more comfortable with.