It has happened to someone else that the servomotors do not work

I can’t get my servomotor to work

here the code

Servo servo;

void setup() {
    pinMode (D1,OUTPUT);
    servo.attach(D1);
}

void loop() {
    servo.write(0);//movemos el servo a 0 grados
    delay (1000);
    servo.write(90);//movemos el servo a 0 grados
    delay (1000);
    servo.write(180);//movemos el servo a 0 grados
    delay (1000);
}

(EDIT: I’m inviting @eleazar to formulate his question in English)

hola @eleazar y bienvenido a la comunidad!
Por favor toma en cuenta que esta es una comunidad en ingles. Si bien alguien puede ayudarte en espa#ol, obtendrias probablemente mucha mas ayuda si formulas tu pregunta en el idioma compartido de la comunidad.
En resumen, te invito a pasar tu pregunta al ingles.

Un saludo!
Gustavo.

3 Likes

The Servo will need to be powered from 5V - VIN pin not 3V3

Also, only PWM capable pins can be used for the signal - D1 is OK for that.

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.