First time on the forums, sorry to ask such a basic question however when things aren't working I need to ensure I'm referencing the right thing before I start trouble shooting other options. Next to no Arduino experience but I'm trying to read a sensor value from some analogue pins. I'm using a ATMega2560 and the signal pin is currently plugged into PF6 which according to the pin mapping is Analogue Pin 6. I'm just trying to double check what reference I should be putting in to gain a value from it via analogueRead(). Should it be PF6 the ATMega name? A6? AN6 which is printed on the board I'm looking at? I've just tried a few different things with seemingly no result, just wanted to double check.
Just a 6, AnalogRead() knows you are using an analog channel:
float value = analogRead(6);
The reference is helpful:
Thanks for posting that reference. Still finding my way around the site so it's handy to know things like that are around for functions.
I looked at the example here http://arduino.cc/en/Tutorial/ReadAnalogVoltage which had A0 which lead to some confusion (along with ANx being printed on the board).
The A0, A1, A2, etc. names are aliases for the analog pins being used as digital pins.
While the functions that deal with analog pins have been modified to accept A0, etc., the value of A0 is 14 on a 328 based Arduino, and 54 (or thereabouts) on a Mega. In my opinion, they look silly in analogRead() calls. The analogRead() functions should be called with (in my mind) a value between 0 and one less than the number of analog pins on the board.