Rookie Team Programming Issue

Rookie team here. We are trying to add a potentiometer into our gearbox motors, and we are having some difficulty in understanding where to place the potentiometer in the program. We are using Easy C as our programming language.

The purpose for the potentiometer is to regulate our ball launchers rotational speed.

We have used the default code for our robot as it meets our robot specs for operation. Our problem is placement of potentiometer programming into the existing program.


I don’t know if you want to use a potentiometer rather than a quadrature encoder or an IME. Potentiometers do not spin freely as quadrature encoders do

It I remember correctly a potentiometer is used mainly on arm pivots and stuff that don’t spin past like 270 degrees as they can’t spin more than set amount. Where as encoders count the revolutions of a shaft which is probably what you want as I am assuming you are trying to calculate rpm of the flywheel with it.

To echo what everyone else is saying, you want to use some sort of encoder, not a potentiometer. They cannot turn more than 270 degrees without damaging the sensor.

Our team puts a lot of time and focus into outreach (especially for rookie teams), so if you have any additional questions, email us at and we would be more than happy to help you in any way possible.

Thanks for the responses.

Can we not use the potentiometer to regulate voltage, which in turn we can regulate the speed of gearbox? We plan to adjust the applied voltage to slow or increase the speeds. We understand we can only regulate the speed prior to competition.

Potentiometers measure voltage in a way. They measure resistance when they are turned which is turned into a number which corresponds to the amount of rotation. You could use it to preset speeds based upon what the voltage of the battery you are using is at but that requires you to know what the voltage is and then turn the dial to the correct section which then sets the speed within the code. Whereas the easier way I think would be to just statements within your code checking the battery voltage and adjusting the power sent to motors based on that. Sorry if that isn’t what you want.


Thank you for your help. I think a simpler solution for us would be for the operator to adjust how much he depresses the joystick,; this too will adjust the voltage to the motors.

As a rookie team we are trying to keep it simple. After the season I think we will try more advanced programming.

Thanks again

I guess I’ll pitch in just to help out a rookie team for rookie’s sake. We used to use EasyC but then switched to RobotC.

The main thing with potentiometers is that they are not counting revolutions endlessly, they only have a limited range.
The best thing you can do is use an encoder, either IEM or Quadrature Encoder sensor.

The thing about regulating motor speed is that you need to set up an equation that reads the ticks per second, set that equal to the speed, and when it isn’t set equal to that speed, adjust to keep it constant.

PseudoCode Setup:
float desiredmotorspeed=entermotorspeed here;
float motorspeed=Sensor[Encoder]/time;
Increase motorspeed by increment;