0

I have a Futaba S148 servo (https://servodatabase.com/servo/futaba/s148) connected to an Arduino Uno.

As soon as the script attaches the servo, it rotates to its limit and gets stuck.

I've tried several scripts, and narrowed to the simplest:

#include <Servo.h>  // servo library
Servo servo1;  // servo control object
void setup()
{
  //  Attach the servo1 object to digital pin 4.
  servo1.attach(10);
}
void loop()
{
}

Also connected the servo to the board with this:

#include <Servo.h>  // servo library
Servo servo1;  // servo control object
void setup()
{
  //  Attach the servo1 object to digital pin 4.
  //servo1.attach(10); <--- notice this commented out
}
void loop()
{
}

and then the servo remains still.

I'm using a battery pack of 4.8 V which works fine with the servo and the RC radio, so the battery and the servo, works fine together with remote control.

I have another different SG90 servo running with its own power source and connected to the pin 9, and with a different sketch, it works perfectly.

1 Answer 1

1

https://www.arduino.cc/en/Reference/ServoAttach - This should answer it. The library you are using supports only 2 specific pins

5
  • oh, good thinking..but it is now in pin 11, because I tried so many things that didn't work out...I've tried with 9 and 10 also with the same result. I'll try again just in case and update the question if nothing changes.
    – Gab
    Sep 28, 2018 at 10:05
  • tested, same result, once attached the servo rotates until the limit.
    – Gab
    Sep 28, 2018 at 10:09
  • Have you tried the default examples? If you go to File -> examples ->servo, there are 2 scripts, sweep and knob. Try them. Also, use external power source for servo, do not power it from Arduino 5V
    – user33153
    Sep 28, 2018 at 12:35
  • I've tried the Sweep one, as it is simpler, and keep the servo unplugged from power until the program is uploaded. Then I connect the battery and the servo runs out the limit :(
    – Gab
    Sep 28, 2018 at 13:12
  • Well...I think is a cable problem...it seems that the long cable I connected between the servo and the arduino board is too long (1.5m) and mess with the signal, does it make any sense?
    – Gab
    Sep 28, 2018 at 16:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.