created analogWrite function