replaced digitalWrite with analogWrite