analogic inputs FS

Good afternoon,
I need your help. I am using an Arduino Mega 2560 board and I have 10 analog inputs connected, my voltage in these inputs changes when my inclinometers are moving. Then this voltage is between 0V and 5V and Arduino has a FS between 0 and 1023.
My question is, how is possible that the voltage that Arduino has in the analog input pins changes and Arduino always has 1023?

I am trying understand this with this easy example and it always is the same (1023), i don't understand anything... Can you help me, please?
I expect your answer. Thank you.
My best regards.

#include <SPI.h>
#include <Ethernet.h>
#include <Wire.h>   // Incluye la libreria Wire
#include "RTClib.h" // Incluye la libreria RTClib
#include <EEPROMEx.h>
#include <math.h>
const int giPinSeguidorG1[5] = {36, 32, 31, 30, 33}; 
const int giEAnalogicasG1[5]= {0};
void setup()
{
  Serial.begin(9600); 
  Wire.begin(); 
}
void loop()
{
  int A= 0;
   A = analogRead(giEAnalogicasG1[2]); 
  delay (1000);
  Serial.println ("El valor de la entrada analogica es:");
  Serial.println (A);
}
const int giEAnalogicasG1[5]= {0};

What is the point of declaring an array of zeroes that are const?

  int A= 0;
   A = analogRead(giEAnalogicasG1[2]);

Why two lines, why not:

  int A= analogRead(giEAnalogicasG1[2]);

When you are getting 1023 what is the voltage on analog pin 0 and
on AREF?

analogRead(giEAnalogicasG1[2]);

And what value is at index 2 of that array? I'll bet it's not a valid analogue pin number.


Rob

MiguelLopez:

const int giPinSeguidorG1[5] = {36, 32, 31, 30, 33}; 

const int giEAnalogicasG1[5]= {0};




You declare an array of pin numbers, followed by a (useless) constant array of (presumably) values you want to set with an analogRead() of the pin numbers.



A = analogRead(giEAnalogicasG1[2]);




Then you read a pin contained in the constant array of values, which are all zero values.

So you are trying to reaad an analog value from pin 0. Not going to work.

So you are trying to reaad an analog value from pin 0. Not going to work.

No? Why not? Presuming, of course, that there is actually something connected to analog pin 0.

The problem was the board. It has the analogic input broke, because they always are in 1023 and the voltage is changing but the input is always in 1023 (FS).

Thank you for your replies. I have bought other board.