Digital Ruler / Linear Displacement Sensor

For a long time Node-Red has been my friends, as things seems to be SO EASY, but I have learned my lesson :frowning:

I have bought a Linear Displacement Sensor, and I am able to the readings that I need, but now I want to compare measurements, and this is where I have problems.

I would like to be able to measure and compare the distance between the sensor and the object over time. ie, in x minutes how far did the object go....

From SerialIn I have the distance, and this I would like to be "calibrated" into a relative 0/zero, but how do I check the distance between the current measurement and the "calibrated 0/zero"?

Store the calibrated value in a Flow or Global variable and subtract this value from the actual value.