analogWrite not functioning in if statement

You can just not advance the number if the time now (from millis() ) has not advanced much (eg. by more than 500) from when you last noticed the hand.