Can I put a potentiometer between three GPIO pins, using two to give 5V and GND?

I don't need all the pins on my Arduino Nano for my project and it would be mighty convenient if I could just connect my potentiometer across, say, pins A4, A5 and A6. I was thinking I could set A4 to be low, A6 to be high and then read the potentiometer setting from A5. Would that work? Thanks.

I could set A4 to be low, A6 to be high and then read the potentiometer setting from A5. Would that work?

I don't see why not. Just make sure that A5 never gets set to OUTPUT. And if you want to save current, set A6 LOW to put the pot in "standby".

groundFungus:
I don't see why not. Just make sure that A5 never gets set to OUTPUT. And if you want to save current, set A6 LOW to put the pot in "standby".

Thanks for responding. I just chanced across this which says that the analogue pins A6 and A7 on the Nano can only serve as inputs: digitalWrite() - Arduino Reference "The analog input pins can be used as digital pins, referred to as A0, A1, etc. The exception is the Arduino Nano, Pro Mini, and Mini’s A6 and A7 pins, which can only be used as analog inputs."

I will solve that by just moving my potentiometer along to A3, A4 and A5 instead. So many pitfalls!

I was planning to use a 5K potentiometer, although I have a few higher and lower values I could use instead. I'm going to be powering the project from USB (i.e. from the mains) so power isn't really an issue but I guess I might as well put A5 in stand-by (i.e. LOW) inbetween measurements anyway.

Yes, I forgot that A6 is analog input only. I have never used Nano so it did not register.

I’d go higher in resistance....
You need to reduce the nett current across the pins supplying +5 and 0V.

10k would be easy to find, and better.
Careful to choose a linear or log taper pot as needed, or your results will be skewiff!

Aside: How hard is it to find clean +V and 0V on your board ??

You can of course still use A4, A5 and A6, just connect the wiper to A6 instead.