Installing a pot to control a Stepper Motor in Marlin firmware

The problem with Marlin is that it is HUGE. I would borrow parts from Marlin and write a much smaller sketch to control the three steppers and the two heaters. The RAMPS board pinout will tell you which pins control which devices.

Stepper drivers are easy. You have one pin to set direction and another pin you pulse to take a step. Pulse the step pin at a fixed rate and you get a fixed speed.

The hot-end heaters have a thermistor for feedback. Typically you would use PWM to control the heater.

So use PWM on Pin 8 and Pin 10 to control the extruder heaters. Use the T0 (A13) and T1 (A14) connectors for your extruder thermistors. The AUX2 connector has several Analog Input pins you can use for your pot: A5, A9, A10, A11, and A12. The E0 and E1 connectors are for the two extruder steppers . E0_STEP is Pin 26. E0_DIR is Pin 28. E1_STEP is Pin 36. E1_DIR is Pin 34. You can use the X, Y , or Z connectors for your other stepper. See the schematic for their pins: