Problems with Servo Motor

I have zero knowledge of servos, but I can probably help anyway…
If you’re using the standard sketch builder code it will contain a line in void setup() that says:

  servo.attach(9);

This tells the servo library that you are using GPIO pin 9 to control your servo.
The Wemos D1 Mini doesnt have a GPIO 9 available on any of the pins, so you should try changing this to:

  servo.attach(2);

and connect your servo to the pin labelled D4 on your Wemos (the screen-printed labels on the Wemos do not correspond to GPIO numbers, D4 = GPIO2 on the D1 Mini.

Pete.

1 Like