DC Motor and Potentiometer positioning

Which bit of the program do you need help with? I can understand your test program.

What is the next step? I think to ask the motor to turn until a specific value is reached on the potentiometer. Initially hardcode the targetvalue in the program, making it dynamic from the serial port (or other source) comes later.

To avoid damaging you potentiometer, you can manually turn the potentiometer and see the motor move or not. Mechanically couple the two together when everything works.

In loop(), when not doing serial (ie when available()==0) check the pot value. If it is less than targetvalue call motorturn one direction. If it is more than targetvalue call motor turn other way.

Check that when you manually turn the knob you can make the motor tun one or other way.

The targetvalue test has to include a dead band, ie the test should be less than magicvalue-5 or greater then targetvalue+5