DSS M15S with arduino

Hello, i've a DSS-M15s that i want to control with an arduino, i've seen this video : How to control DSS-M15S servos with Analog Feedback - DFROBOT - YouTube but i'dont have the "feedback" on my motors so i try whith a simple code :

#include <Servo.h>

Servo monservo;

int positionDuServo = 0;

void setup ()

{ 
  int servoPin= 10;
  monservo.attach(10);
  monservo.write(positionDuServo);
}

void loop()
{
  for(positionDuServo =0; positionDuServo <= 180; positionDuServo++)
  monservo.write(positionDuServo);
  delay(15);

    for(positionDuServo =0; positionDuServo <= 180; positionDuServo--)
      monservo.write(positionDuServo);
  delay(15);
}

and it's not working, if someone can help mmeee plzz

Try indenting that

Oops.

I did that

  for(positionDuServo =0; positionDuServo <= 180; positionDuServo++)
      monservo.write(positionDuServo);
         delay(15);

    for(positionDuServo =0; positionDuServo <= 180; positionDuServo--)
       monservo.write(positionDuServo);
        delay(15);

And what's the problem withe my "positionDuServo --" ?

Have another go with the indentation.

The problem with the decrement is that Servo doesn't take negative angles

{
  for(positionDuServo =0; positionDuServo <= 180; positionDuServo++) 
  {
      monservo.write(positionDuServo);
         delay(15);
  }

And . .?

Is this good ??

I don't know - you're the one with the hardware
(And also the only one who knows what 'good' means)

Okay

void loop()
{
  for(positionDuServo =0; positionDuServo <= 180; positionDuServo++) 
  {
      monservo.write(positionDuServo);
         delay(15);
  }

    for(positionDuServo =180; positionDuServo <= 0; positionDuServo--)
    {
       monservo.write(positionDuServo);
        delay(15);
    }
}

It looks like this and it dosen't work

Oops

    for(positionDuServo =180; positionDuServo >= 0; positionDuServo--)

Okay now this, and still dosen't work :smiling_face_with_tear:

"doesn't work" is about the single most pointless phrase you could post.

We don't know what "works" means, so how can we know what "doesn't work" means?

Okay, works is : the motor is moving
Now it's not moving
I'm sorry i'm a full newbie lol

Have you checked the wiring?
Did you run the sweep example code?
Did that "work"?

The wiring is 100% ok
What's the sweep example code ?

Just about every library, like "Servo", comes with example code that is (mostly) proven to work.

Do you have a solid power supply for the servo?

I tried it, the motor is not moving.

I have this power supply

I tried with another motor and it's not moving to

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