The servo motor does not start

Hello.

I just bought this servomotor (https://www.amazon.com/dp/B07CMBMWZW) and it won't start. My code is the following:

#include <Servo.h>

// Declaramos la variable para controlar el servo
Servo servoMotor;

void setup() {
  // Iniciamos el monitor serie para mostrar el resultado
  Serial.begin(115200);

  // Iniciamos el servo para que empiece a trabajar con el pin 9
  servoMotor.attach(9);
}

void loop() {
  
  // Desplazamos a la posición 0º
  servoMotor.write(0);
  // Esperamos 1 segundo
  delay(1000);
  
  // Desplazamos a la posición 90º
  servoMotor.write(90);
  // Esperamos 1 segundo
  delay(1000);
  
  // Desplazamos a la posición 180º
  servoMotor.write(180);
  // Esperamos 1 segundo
  delay(1000);
}

I have it connected to pin 9, GND and 5V. Before I had bought another servo motor that if it worked (this: https://www.amazon.com/dp/B07NQJ1VZ2), why not the new?

Because it hasn't got its own power supply?

1 Like

You're right, I put it on 5V and it needs 7.

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