I'm trying to use the internal 1.1 volt analog reference with my Mega2560 board.
This code:
void setup() {
pinMode(Sensor, OUTPUT); // set pin to drive sensor
// analog pins are always inputs
Serial.begin(9600); // open serial port
analogReference(INTERNAL); // sets AREF to 1.1v
Causes this error:
Test590.cpp: In function 'void setup()':
Test590:11: error: 'INTERNAL' was not declared in this scope
I have tried it with 'INTERNAL1v1' and 'INTERNAL2v56' and get the same error.
Thanks, guys. It was the lower case "v". One of the references I was using just had "INTERNAL" and the other was "INTERNAL1v1" - docs don't have to run, I guess
While I'm on it AMTEL's spec sheet "ATmega640/1280/1281/2560/2561" says that it is possible to use some of the analog inputs to take differential readings. This would be ideal for my app but I don't see it in the programming docs. Any ideas?
I'm very new to Arduino - but I'm startin' to like it!
artk13:
While I'm on it AMTEL's spec sheet "ATmega640/1280/1281/2560/2561" says that it is possible to use some of the analog inputs to take differential readings. This would be ideal for my app but I don't see it in the programming docs. Any ideas?
You set ADMUX (ADC Multiplexer Selection Register) and ADCSRB (ADC Control and Status Register B) to select which combination of A/D inputs are selected and what gain to apply (1, 10, or 200).
See Table 26-4 of the datasheet for the choices.
The table seems quite wonky; there are many options shown where the Positive Differential Input and Negative Differential Input are the same pin! Wouldn't that always result in a reading of zero?
Thanks, I'll study that. If I figger anything out I'll post here. I'd say if you connect two signals to the same pin there might be damage somewhere ! ?