Tracking a non-servo

So far I have this code hooked up to a motor that it says was a servo, but it is not (sm-s4303r-ccw).

#include <Servo.h>;

Servo myservo;

int pos = 0;

void rotate() {

  for(pos = 0; pos < 180; pos += 1)
  {                                   
    myservo.write(pos);               
    delay(15);                        
  } 
  for(pos = 180; pos>=1; pos-=1)      
  {                                
    myservo.write(pos);              
    delay(15);
    
    //delay(86400000);
 
  } 

} 

void setup() 
{
  myservo.attach(9); 
  myservo.write(0); 
    

  rotate();
}

void loop()
{  
}

Is it possible to track the position with a non-servo, because I recently found out that it is not a servo. This code just makes it turn one way forever.

Are you saying it is a "continuous rotation "servo""?

You can't know or set the position of such a device. It is pointless trying.

Ok. Thanks. Do you have any clue where I can buy a SERVO that isn't continuous rotation but can turn over 360 degrees?

Yep, do a search for sail winch servos. Most have full positional control over about 4-6 complete rotations.

Steve

Thanks.

Most have full positional control over about 4-6 complete rotations.

At a (not insignificant) cost.

PaulS:
At a (not insignificant) cost.

If you know a way of achieving the same end with no significant cost I''m sure the OP would be pleased to hear about it.

There are relatively inexpensive winch servos (£12-15) but given their intended purpose they're all fairly large. You don't really see any very small very cheap things like SG90 equivalents.

Steve

Would a stepper motor (with gear reduction if you need more torque) work for you? Is it enough that you know the present position of the motor by counting steps from a home position? If so, a stepper motor might work for you.

If you know a way of achieving the same end with no significant cost I''m sure the OP would be pleased to hear about it.

I don't. I was just pointing out that you can't get something for nothing. There are always trade-offs - more hardware (encoders), more cost, larger size. OP needs to determine where the trade-offs outweigh the benefits for his/her project. Maybe a different kind of motor would work, instead.