Increasing servio motor RPMs

So I have a fairly simple application. I have a servo motor that I’m wanting to go from zero RPMs to 30 RPMs over a period of about 30 seconds. Basically a very slow increase in speed. I’ve tried to write the code where it would engage The servos then wait 10 seconds then I went to another line of code increase the speed wait 10 seconds so on and so forth. But that’s not working. What I’m looking for is what the code would look like for a gradual smooth increase from 0 RPMs to 30 rpms. Any help would be greatly appreciated

You placed this under V5, but were asking the same thing in a topic related to ROBOTC.

Which system are you using ?

Do you have a servo (limited movement, perhaps +/- 50 degrees) or a motor ?

If a motor, to increase over a period of time, just create a loop that sends motor speed with a delay, increase speed each time around the loop. In C pseudo code it may look like.

int speed;
for(speed=0;speed <=30;speed++) {
   send speed to the motor
   wait for 1 second
}
3 Likes

I am using a modified 3 wire PWM servo made by savox, and it rotates 360*. I have by-passed the hall sensor. I just need it to slowly rampup to speed.

And I am using the VEX Cortez and programming in robot C.

ok, I moved the topic out of V5. so it will look something like this (change the motor port etc.)

int speed;
for(speed=0;speed <=30;speed++) {
   motor[0] = speed;
   wait1Msec(1000);
}
3 Likes

It is giving me an " executable statements not valid in ‘main’ declaration block"

well, I don’t know what you entered, but it should be something like this.

#pragma config(Motor,  port2,            ,             tmotorVex393_HBridge, openLoop)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

task main()
{
  int speed;
  for(speed=0;speed <=30;speed++) {
    motor[port2] = speed;
    wait1Msec(1000);
  }
}
4 Likes

I had a bracket in the wrong place. So at least it the s the servos in, but it doesn’t ramp up to speed. Basically it is at fill throttle as soon as you turn in the switch.

Any ideas? I don’t have the 393 h bridge statement in my program. Us that needed even though I’m using a savox servo?

A 3 wire servo would not usually use a H-bridge, just plug into one of the cortex 3 wire motor ports (assuming this servo is compatible, same pinout as a VEX servo etc.)

4 Likes

Yes it works but it still doesn’t go from 0 to 30 RPMs over the course of 10 seconds. It goes from 0to 30 in about 1 second. There is no ramp up. Any ideas? Thanks.