potentiometer

How would I increase motor speed as a result of a potentiometer increase?

I was thinking about this also. I was thinking about maybe setting the value of the potentiometer equal to the power of the motor, but with that you have to some math because the motors are limited to -127 to 127 and potentiometers are 0 - 4095. So you just have to figure out how to make 4095 = 127 and then 2047.5 = 0 and 0 = -127. This is just an idea I’ve brainstormed not sure if it will work but best of luck to you.

or just have 0 = 0 and then increase until 127 = 4095

thanks
I was thinking

potentiometer value =motor value(32.2)

but what would the code look like?
void (sensorvalue(potentiometer/32.2)==motor[rightMotor]);

It would look something like:

``````
#pragma config(Sensor, in1,    pot1,           sensorPotentiometer)
#pragma config(Motor,  port1,           driveMotor,    tmotorVex393_HBridge, openLoop)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//