Pages: [1]   Go Down
Author Topic: Anyboby have experience with analogReference(type)  (Read 354 times)
0 Members and 1 Guest are viewing this topic.
Colorado
Offline Offline
Newbie
*
Karma: 0
Posts: 20
Arduino F@#$%*g  ROCKS
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm just starting to do some basic programs with a potentiometer and the
Code:
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:
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:
analogreference(internal)
I got an error message that it was not declared in the scope.  So I added it as
Code:
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:
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?
Logged

London
Offline Offline
Tesla Member
***
Karma: 10
Posts: 6250
Have fun!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
« Last Edit: April 28, 2009, 12:10:12 pm by mem » Logged

Pages: [1]   Go Up
Jump to: