Go Down

Topic: Anyboby have experience with analogReference(type) (Read 389 times) previous topic - next topic

SteveB inCO

I'm just starting to do some basic programs with a potentiometer and the
Code: [Select]
AnalogRead function.  And I was trying to find ways to increase the resolution say if I had an input of 2 to 3 volts or for a lower voltage input.  I came across this function
Code: [Select]
AnalogReference(DEFAULT, INTERNAL, or EXTERNAL) but it has either been modified since the function definition was written or I found something peculiar.  When I used it as
Code: [Select]
analogreference(internal) I got an error message that it was not declared in the scope.  So I added it as
Code: [Select]
int internal but thought that I needed to set it equal to something.  Through a few trials I found that if you set it equal to 10, and using the board 3.3 volt refence I can receive 1023 from the
Code: [Select]
analogRead the same as if I were using a 5 volt reference.  

Just wanted to get someones thoughts on this.  Is this function supposed to work like that?

mem

#1
Apr 28, 2009, 07:09 pm Last Edit: Apr 28, 2009, 07:10 pm by mem Reason: 1
INTERNAL is a constant and its case sensitive. So you have to enter it exactly like that.

the internal reference is 1.1 volts so that won't work if your voltage is greater than that. How accurate do you need your measurements?

Go Up