implement analogWrite()