Analogread

I am using analogread() from pin A0 and as the function is suppose to return me an int (0 to 1023), I only get 0-256 when the voltage get to 1.1V. Then its start 0-256 to 2.2V.

I have also put the analogreference to DEFAULT. (suppose to be 5V)

I also tryed EXTERNAL and apply 5V.

DO you know how I am suppose to get a scale from 0-1023 with a 0-5V ????

Thankx

int analogPin = 0;
int voltage = 0;
...
pinMode(A0, INPUT);
analogReference(DEFAULT);
...
voltage = analogRead(analogPin);    // read the input pin
...

If you copy that code into the Arduino IDE, will it even compiler? Of course not. Therefore, the problem is not with that code. Post the real code that contains the problem. All of it.

If you want to read 0 to 1023 for 0 to 5V, you do not have to call analogReference() at all. So, don't.

It sounds like at some point you are placing the value into a Byte variable.

Try the following code:

void setup()
{
  Serial.begin(9600);
}

void loop()
{
  Serial.println(analogRead(0));
  delay(250);
}