I am short of digital pins on arduino nano and wish to use analog as digital. But the problem is I have 3 analog sensors already hooked up to analog pin 0 ,1, and 2.
From what I read on the internet, it says that one can use analog pins as digital if all analog pins are not in use.
So, my question is can I use some analog pins as analog input and some analog pins as digital output ?
Yes you can. All pins default to digital input on reset. The analog inputs only become analog inputs when analogRead() is called. You can also use INPUT_PULLUP same as regular digital pins.
Ive att attched an image with the due and mega showing pinouts. next to where the A0, A1 etc is the digital numbering search for similar images on the net if you got something else.