i was experimenting earlier with my arduino and decided to try using a digitalRead on my analog pins and to my surprise, it worked. then i tried doing a digitalWrite to one of me analog pins and to my even bigger surprise, it worked. is there any danger is using these pins this way? why does the arduino page for the uno not mention that these can in fact be used this way?
From here
The analog input pins can be used as digital pins, referred to as A0, A1, etc.
Note however, that on some boards (e.g. Nano) pins A6 and A7 are analogue input pins only - they have no digital functionality.
Yes it works.There is no danger using it as output since you don’t exceed the max current like the other pins.
There is no danger using it as output since you don’t exceed the max current like the other pins.
There's exactly the same danger of overloading as on any other digital pin.
ok. thanks. so in actual fact the arduino uno has 20 gpio pins?
Yep and A0 == D14 etc.
Mark
ryan27968:
ok. thanks. so in actual fact the arduino uno has 20 gpio pins?
upto 23, but two are used for the crystal oscillator and one is the reset pin (reprogramming the chip fuses
can make these pins available as GPIO on a standalone board). All documented in the ATmega88/168/328 datasheet.
and would any of the analog pins happen to be pwm pins?
No. The pins that are are labelled with a tilda on the PCB.