analogWrite on pin 9 or 10 stops working with a servo

  • Arduino Uno
  • Servo

Why it happens

  • On most boards the Servo library switches off PWM on pins 9 and 10, even if the servo is elsewhere.

How to fix it

  1. Move the LED or motor speed wire to pin 3, 5, 6 or 11.
  2. Change the pin in the code.

It worked if: The LED fades again.

From the official documentation. From the Arduino Servo library page. Sources: Arduino Servo library.

Didn't help? Search another error or ask us.