Analog vs Digital

I am making a GPS watch and both the GPS and the LCD use almost all of the digital I/O pins and I still need 5 pushbuttons to change the start, start, volume, etc. I spend about half a second thinking and i realize that none of my analog pins are being used. Problem solved... sort of. I just have no idea what code to use to use the analog pin instead of a digital pin. I figure this is possible because a potentiometer is practically a pushbutton with a ton of values between off and on. (I think like 1023 but thats not the point). So thats that.

Thanks in advance :astonished: :money_mouth_face::money_mouth_face: :astonished:

jrwj

On Arduino 2009 analog pins A0-A4 are digital pins D14-D18.

The reference section on this site, which is duplicated off line in the IDE in the help menu, has a lot of information about the functions that are available to you, organized by category. Have you looked there?

I figure this is possible because a potentiometer is practically a pushbutton with a ton of values between off and on. (I think like 1023 but thats not the point).

So how will you know when the "button" is pressed or not? Or long-pressed? Or double-pressed?

To address your problem more directly, it is possible to detect multiple push buttons with a resistor network and one analog input.

I still need 5 pushbuttons to change the start, start, volume,

It is also possible to reduce the number of buttons from 5.

florinc: It is also possible to reduce the number of buttons from 5.

Sure. Most watches only have 3.

I didn't see watches with potentiometer yet :)

florinc: I didn't see watches with potentiometer yet :)

It might make setting the time easier. :)