Analog In with digital inputs

Can you use the analog inputs with digital input devices like pushbuttons?

Thanks John

Can you use the analog inputs with digital input devices like pushbuttons?

You can. But, you can also refer to the analog pins AS digital pins, using the names A0 through A5. These names correspond, on the Duemilanove/UNO to 14, 15, etc. They have different values on the Mega.

So, you can do

int state = digitalRead(14);

or

int state = digitalRead(A0);

Thanks PaulS

John