View unanswered posts | View active topics It is currently Wed Aug 12, 2020 2:28 pm

Reply to topic  [ 2 posts ] 
servo speed 
Author Message

Joined: Sun Feb 06, 2011 11:22 pm
Posts: 3
Post servo speed
Can the speed of a servo motor be controlled through robot c programming?

Tue Mar 01, 2011 12:11 pm
User avatar

Joined: Tue Sep 14, 2010 9:19 pm
Posts: 496
Post Re: servo speed
I don't know if you can directly control the change rate of the servo, but here is a simple piece of code you can write to control the speed of the servo:
void moveServo(tMotor servoName, int  endPos, int timeToTake){
  int currPos = motor[servoName];
  int period = timeToTake / abs(currPos - endPos);//time to wait between each movement
  if(endPos > currPos){
    for(int i = currPos; i < endPos; i++){
      motor[servoName] = i;
  else if(currPos > endPos){
    for(int i = currPos; i > endPos; i--){
      motor[servoName] = i;

I'm not sure if I have made an error in the syntax as I do not have ROBOTC in front of me right now, but that is the general idea.

sudo rm -rf /

Tue Mar 01, 2011 5:27 pm
Display posts from previous:  Sort by  
Reply to topic   [ 2 posts ] 

Who is online

Users browsing this forum: No registered users and 1 guest

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.