Congratulations Dave Schulpius, for answering the question and has received an EZ-Credit award! Share what you have learned and create a tutorial to help others by clicking here.

Motor Controller Ramping Script Help

Assistance Requested

Help Steve G with their question and receive $10 of EZ-Credit to get more robots and parts from our store. The following information was provided about their previous efforts searching tutorials for a resolution.

Steve G claims to have checked these sources:

E4-B4 has been a little neglected lately, so or been playing trying to give him more graceful drive movements, so I'm looking for a little help with a ramping script to be used in a custom Movement Panel for my motor controller. I read a thread some time ago where DJ posted that ServoSpeed() commands can be used, so I have tried the following script for moving forwards...



PWM(D3, 0)
PWM(D1, 0)

Set(D2, Off)
Set(D0, Off)

PWM(D3, 65)
PWM(D1, 65)

I have setting tried different servo speeds, but the ramping part does not seem to work. I have also had a go at converting @Rich's Sabertooth ramping script, but could not get my head around where I needed to make the changes. Can anyone help me with a ramping script to ramp up when I hit forward or reverse, and ramp down when I hit "Stop" for the following movement commands...


Set(D2, Off)
Set(D0, Off)
PWM(D3, 65)
PWM(D1, 65)

Set(D2, On)
Set(D0, On)
PWM(D3, 65)
PWM(D1, 65)

Set(D2, Off)
Set(D0, Off)
PWM(D3, 0)
PWM(D1, 0)


I have found a few conversations, tutorials and activities that may help with your question. Take a look at these links. I've sorted them by what I believe to be most relevant but that is not always the case as I'm still learning.

Also, consider reviewing the Learn section for informative lessons and activities. Check it out!


I may be way off base here, but if I were trying to get a servo to ramp up I would try:


$TopSpeed =65 #Whatever top speed number would be
$NextInc =1
repeatwhile $NextInc <= $TopSpeed
sleep(500) #Just a guess. Whatever rate of ramping you want.

If the ramping is too slow incrementing by 1 you could increment $NextInc by a larger number. Though probably changing sleep time would do the trick.

I haven't actually tested this. Just off the top of my head.

Same for ramp down but start at current speed setting and decrement until minimum/stop speed setting is reached.



Thanks for the reply. I'm not sure if that's the kind of thing I'm looking for, but it could be. Not sure how to use it with my direction commands, but I'll have a play with it to see if I can make something of it (unless someone comes up with another solution).

Thanks, and happy holidays. Smile


Bumping thread as I still need help with this.


Steve, are you using a Sabertooth?


Hi Bob.

No, it's a DEOK motor controller/H-Bridge.

User-inserted image


The servospeed only adjusts ramping on continuous rotation servos. Something like the Sabertooth ramping script is needed for a PWM H-bridge (although interestingly, if you drive your movement with a joystick/game controller it ramps the PWM so maybe this is something DJ could just add to the Movement Panel to do when driven by the keyboard or script commands too)

If you are using a Sabertooth, I am pretty sure you can turn on Ramping with Describe software. Now that I finally have my basement back and getting my tools unpacked, I am finally going to wire up my Sabertooth to some wheelchair motors and start getting some hands-on knowledge on this.



Hey Alan.

This is a quote from DJ talking about the script example he posted in the link on post #1 above...


For PWM H-Bridge, simply use the ServoSpeed(). As in my above example. The servospeed() will ramp the speed between PWM's.

It looked to me that this should work with the motor controller I'm using as it uses PWM as well. It will be a couple of months at least before I get my hands on a sabertooth, so I'm stuck using the motor controller in post #6 for now.


Hmm... I'll play with that on my Roli which has an LM298 H-Bridge and see if I can figure it out. As usual, no guarantee on time. Lot's to do and not enough hours in a day to do it...



Lol, Alan, I know exactly what you mean.

Anyway, thanks.