Need help with code.

      previous = reading;This is in the wrong place, and what about the previous readings of the other two inputs ?

I see that you did not follow my advice to name the variables with a 0, 1 or 2 at the end. You can make the program work by using two and three but using 0, 1 and 2 makes the change to using arrays to hold the variables much more obvious.