An0 - 5 and Dig0 - 5 in the same program?

I don't have an Arduino, but I'm contemplating using it for a project that will use all the chip's I/O.

I've looked over the Reference material and the Tutorials, and have looked around the Playground. None of the sample code I've seen has used the low-numbered digital lines at the same time as the analog lines.

How do you declare these in a program?



You actually use the numbers for both: 0 to 5. The function you call operates on either analog or digital pins, so it knows what to do. E.g. if you call digitalRead(2), it reads from digital pin 2. If you call analogRead(2) it reads from analog pin 2. You don't need to call pinMode() for the analog inputs; so it also operates on the digital pins (e.g. pinMode(2, OUTPUT)) sets digital pin 2 to be an output.

That makes sense. I guess you really need to comment your code carefully when doing that, though.

Many thanks.