hold last sensor value

So, you want it to detect the highest value read within some period of time? Remember that the 0 values that it reads are perfectly valid values. Remember also that it will read values from zero up to some high value and then all the way back down to zero.