added analogState[] to prevent using analogWrite() when pwm value hasn't changed, to prevent resetting pwm phase during lighting