Go Down

Topic: Arduino 0019, analogRef Problems? (Read 980 times) previous topic - next topic

tomfleet

Hi all,

I've been working on a transmitter using my MEGA board, and the code has been compiling fine with arduino 0018.

Now, yesterday, I upgraded to 0019, and since then, I can not get my code to compile untill I comment out the line that sets up the analog Ref.  :-?

Code: [Select]
void setup()
{
 Serial.begin(9600);             //Init. Comm
 analogReference(INTERNAL);      //Internal Reference = 1.1V (2.56V on MEGA)
 pinMode(temp_AN,INPUT);         //Set Analog inputs
 pinMode(RH_AN,INPUT);
 pinMode(rp ,OUTPUT);            //Set Outputs
 pinMode(gp ,OUTPUT);
 pinMode(bp ,OUTPUT);
 pinMode(xb_slp ,OUTPUT);
 pinMode(xb_rst ,OUTPUT);
 get_serial();
}



That's the chunk that's causing me problems, won't do a thing untill I comment out the analogRef line, keeps giving me:

Code: [Select]
node_take1.cpp: In function 'void setup()':
node_take1:47: error: 'INTERNAL' was not declared in this scope


Only thing I have noticed is that line 47 actually is the Serial.begin(9600);

Line 48 would be the analogRef...

Any ideas?

Thanks!

wayoda

They messed around with the code I think:

In file wiring.h there is now
Code: [Select]

#if defined(__AVR_ATmega1280__)
#define INTERNAL1V1 2
#define INTERNAL2V56 3
#else
#define INTERNAL 3
#endif


In 0018 that read
Code: [Select]

#define INTERNAL 3


So if you got a Mega Board you must now use:
analogReference(INTERNAL1V1);

This is mentioned in the release notes for 0019 (which nobody seems to read I know).
http://arduino.cc/en/Main/ReleaseNotes

Eberhard

tomfleet

@wayoda

Thanks for the speedy reply! I'll be sure to check out the release notes from now on for new software revisions!

Works a treat, Cheers.

Tom

Go Up