Yes, and that’s exactly what I’m doing: the ADC values is the Arduino’s way of representing voltage. An ADC value of 0 means the voltage is 0, and an ADC value of 1023 means the voltage is AREF (which in our case is 5V).
The startAngleADC and endAngleADC values are the voltages of the wiper of the pot when the pot is at each of the start and end angles that you are using.
Yes, you can combine it. The first two lines of my code are defining constants and can be put at the begging of the program, after line 2 in the example. The third line of my code is the same thing as the 10th line from the example, just with different names. The fourth line is the part that is rescaling the values so that it works with only 100 degrees instead of 300 degrees.
In the example, I assumed that you wanted your output value to be the angle of the pot in degrees, but since you will need to do scaling on the output there may be a more efficient way, such as something like this:
int actuatorTargetADC = constrain(map(potentiometerADC, startAngleADC, endAngleADC, actuatorStartPositionADC, actuatorEndPositionADC), actuatorStartPositionADC, actuatorEndPositionADC);
This calculation will give you the target ADC/voltage of the actuator’s internal pot for when it is at its start and end positions. You will need to add and calibrate to more constants at the beginning to represent these positions:
int actuatorStartPositionADC = 400; // voltage of actuator's pot when it is at the start position
int actuatorEndPositionADC = 800; // voltage of actuator's pot when it is at the end position
Once you have the target ADC value, you can compare it to the actual ADC value of the actuator’s pot and then decide if you need to extend, retract, or do nothing with the position.
Let me know if you want some help with this.