Problems with Servo Motor

Hi there, I’m new with blynk and I’m having some problems with servo motors.
I am making a project with servo motors, and I copied your code in the examples, putted a slide in the app and I though it was it but when I updated the code into my Wemos D1 Mini the servo didn’t move. I’m using the digital port D2 but I don’t see any function that associate the port D2 into the Virtual port 3.

So the main question is how can I associate the port D2 into V3 to make the servo move with the slider.
Thank You.

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

Actually I would recommend D5 or D7 (Arduino 14 & 13) to start with… D4 is linked to the internal LED and has a pull-up resistor built in (as does D3)… Both might still work for a servo, but you will also notice the LED changing intensity if you use D4.