Speed Control

I am wondering how to program a robot to take a joystick control and divide it in half, so that when it is full forward it goes half speed, and when it is half forward it goes quarter speed. i am programming in EasyC.

This is slightly more complicated than running a motor like you would normally.

This is the code that i was able to come up with.

Basically the channel on the controller is 2 and the motor port is 1.

When you push the stick it records the rx_input and it will cut that number in half which will give you half speed.

If you find anything that is wrong in this code feel free to post it, i made this in about 5 minutes.

Sry for the double post but where is cuts the speed in half is wrong.

You have to cut the speed in half but the way i did it wouldn’t work, you have to do a little math to figure it out.

Unfortunately i have to do some other stuff so i don’t have time to fix it!

thanks anyway i figured out the math.

I am glad that it helped!

Also did you get multiple motors to work with this?

It should work but the code may need a bit of tweaking.

Did you try this code? I don’t know if it works but if it does please post!

just redo the math then you can make it work with dual motors