Here's a quick draft. See if it makes sense.
(You don't need the timeout case and you don't need any FOR loops ;))
If you only want to store the last value for multiple slide movements, store them in a shift register and add to the array on "mouse up", for example. Modify as needed.
