No, because they are not equivalent. Normally, when programming for an Arduino, we try to program so that the Mega and the Uno pretty much are interchangeable. It IS a trivial issue because like everything else with this wonderful platform there is a workaround. BUT I can't program pin 14 on the Uno for Analog AND expect pin 14 on the Mega to behave the exact same thus limiting the capability. So I agree with Delta_G that a short addon snippet would solve the problem.
I think you would agree too if you weren't so busy trying to disprove a clear problem. Are we going to get around to solving the problem or are we going to fence around the issue for a second day? This is the premier site for Arduino. We come here for expert SOLUTIONS. I look up to you guys and ALWAYS defer to your expertise. Yet I have provided code clearly showing the problem and I fail to understand why this is such a difficult concept. You insult peoples intelligence by telling them there is no problem, when I have shown there clearly is. It's not funny anymore. Can we just dispense with the jive and move on to the solution portion of this ridiculous ritual?
Besides, I think kids are pretty smart about learning about nicknames - my grandfather's given name was John, but everyone called him Jack. His brother was Robert, but was known as Bob.
In Scouts, everyone knew that Prof's real name was Michael, and that Tabs was really Peter.
Even the church across the road was St. Peter's, but we all knew that Peter's real name was Simon
Deve:
So, does anyone have any ideas on how to make THIS shorter and more streamlined? A solution that a novice programmer could understand and put inside existing code as a function (like below).
One problem is that if the user is smart enough to understand the function then they are smart enough to understand the "problem"
christop's function is a case in point. It is a neat improvement on mine using for loops, but by the time you have explained what either of them do you might just as well explain that the A* pins have numeric equivalents.
I program this nifty must have program that I want to run on the Uno and the Mega without changes. There are a LOT of pins being used, almost to the capacity of the Uno.
I set up pins 14-19 on the Uno for Potentiometers, analog sensors, etc. No choice. Those are the analog pins.
I then try to run this same program, as is, on a Mega. Are you telling me there is no problem?
There would NOT be a problem if the programmer didn't use statements referring to 14-19. If only he would have used A0-A6 to describe them! Pins 14-19 are NOT directly interchangeable.
He COULD use just 0-6 in his code, but wait.. NO! What happens when those pins are needed on the other platform? We just need the reporting to be A0-A6 for those particular pins. Problem solved.
For those of you who shared code.. THANK YOU! I do not mean to be a jerk or anything, but I just get a little testy when people say there is no problem when there clearly is. I apologize sincerely for getting everyone in an uproar. We can move on.. I have solutions now that I think will work. I still wonder if it shouldn't be put in library format so its just a one line addition to the code. Thanks again!