I'm making a POV display. I want to use 12 pins as outputs. I'm refraining from using pin 0 and 1 as they are RX and TX. Pins 2 and 3 have interrupts on them.
I'll be using pin 2 and think I'll leave pin 3 for future interrupt use maybe?
So I want to use digital pins 4-13 and analog pins 5 and 4 for output.
I'd like to have an array or a function called ledPin[], which I can use with digitalWrite.
My concern is with analog pins being A5 and A4 instead of just integers like the other pins. If it were just digital pins, I would declared : int ledPin[]
but how can I include the analog pins in this?
I think I can do this using enumerations but I don't quite understand how..
Using analogue pins for digital I/O is just the same as using digital ones.
A0 is referred to as Pin 14
A1 is referred to as Pin 15
A2 is referred to as Pin 16
A3 is referred to as Pin 17
A4 is referred to as Pin 18
A5 is referred to as Pin 19
Grumpy_Mike:
Using analogue pins for digital I/O is just the same as using digital ones.
A0 is referred to as Pin 14
A1 is referred to as Pin 15
A2 is referred to as Pin 16
A3 is referred to as Pin 17
A4 is referred to as Pin 18
A5 is referred to as Pin 19
Oh, Thanks Alot!
This should be mentioned in the Arduino documentation.
This is exactly where I was confused. It doesn't mention anywhere that they are also referred to as pin 14,15,16..
Not on a Mega they aren't. That's why the A0, A1, etc. aliases were created. You don't need to know what actual pin number is used behind the scenes. Analog pin 0 is A0, on both the UNO and the Mega.