According to the ATMega2560 datasheet, I can select the ADC reference to be EXTERNAL or two internal voltages: 1.1V and 2.56V. However, it is not clear how to specify in the sketch, which internal reference is to be used.
The compiler does not like this:
void setup()
{
pinMode(ledPin, OUTPUT);
Serial.begin(9600);
analogReference(INTERNAL);
}
The board is currently set for External, and I measure 4.8V at AREF. I checked the schematic to the MEGA2560 Arduino board, and I cannot see any connection between the USB port and the AREF net on the schematic.
-
How is this AREF to VCC connection made?
-
What is the right argument for analogReference() to select either the internal 1.1 or 2.56V reference?
Error message:
Arduino: 1.6.5 (Windows 8.1), Board: "Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)"
ADC_read_RT1.ino: In function 'void setup()':
ADC_read_RT1:8: error: 'INTERNAL' was not declared in this scope
'INTERNAL' was not declared in this scope
