Pages: [1]   Go Down
Author Topic: Arduino 0019, analogRef Problems?  (Read 737 times)
0 Members and 1 Guest are viewing this topic.
Cambridge,UK
Offline Offline
Newbie
*
Karma: 0
Posts: 10
If at first you don't succeed; call it version 1.0
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
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:
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!
Logged

Wuppertal/Germany
Offline Offline
God Member
*****
Karma: 1
Posts: 895
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

They messed around with the code I think:

In file wiring.h there is now
Code:
#if defined(__AVR_ATmega1280__)
#define INTERNAL1V1 2
#define INTERNAL2V56 3
#else
#define INTERNAL 3
#endif

In 0018 that read
Code:
#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
Logged

Cambridge,UK
Offline Offline
Newbie
*
Karma: 0
Posts: 10
If at first you don't succeed; call it version 1.0
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

@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
Logged

Pages: [1]   Go Up
Jump to: