Arduino with adjustable voltage regulator

I have made a little project involving a roomba and an arduino and i need a to just make it an all in one contraption. I have been using a 9v batter to run my arduino and thats expensive. Ive decided to try to use a regulator on it. I have a variety of resistors, capacitors if i chose to use them and the lm317 adjustable regulator. Im just confused on how to wire it all up. The specification diagram shows two resistors. One from the adj (ground pin) of the regulator to out. The other from the adj to another ground… Im justconfused if that means the ground from the arduinoto the roomba or ifim bassackwards. As i understand it, i have a capacitor from the in to the ground, resistor from adj to out and resistor from adj to ground. Im trying to go from 14~18v to 12v for the arduino… Any insight would be helpful, thank you!

All grounds have to be connected together.

If you use a 7812 voltage regulator, then you don’t need to worry about resistors. You should have capacitors (10 microfarad or higher) on both the input and output of the regulator, close to it if the wires are long. If you insist on using the lm317, the data sheet shows how to connect it and gives formulas for the resistor values.