Is it possible?   [about analog inputs]

Hello guys and girls. I have a question. Is it possible to use the analog inputs (ADC0~5) as digital outputs, or at least as analog outputs? If so… how? Thanks

PORTC pins 0-5 can be set up as digital outputs anyway–just use DDRC and PORTC. I.e., DDRC = 0x3f sets C0-5 as outputs, and then PORTC = 0x3f sets C0-5 to high.

or you can simply use them as digital pins 14 through 19 :wink:

or you can simply use them as digital pins 14 through 19 :wink:

I didn’t know about that feature. So I can just start using pin 16 in my code as any other digital IO and it comes out analog pin 2? That’s a nice feature of the software?

Can I go back and forth? digitalWrite pin 16 and then analogRead pin 2?

Yep, just got to make the proper pinMode() calls before the digitalWrite() and analogread() calls.

Great, thanks a lot, and so easy. Thanks mates. ::slight_smile:

…and so easy…

It seems that this is what Arduino is all about, and I LOVE it!

Did not know about this either, too simple to be true :smiley: