Voltage Pin

I'm facing problem with the reading the voltage and the analog pin.
I have one code in which there is function,in which i'm reading voltage and pin.
But it's always showing 5V.
i.e.
value is 1023.
Even after varying voltage the voltage is not varying.
But when i copy the same function in the new program,
i'm able to read the various voltage at pin.
Please can anyone suggest what the problem must be?

Please can anyone suggest what the problem must be?

If only you had posted the code and a circuit diagram ....

Circuit diagram is nothing great .
Just connected the POT output to the A3 pin of arduino.
Sorry cant post the code as per company policy.

My crystal ball is in for service, so no code results in no help.

If it's for a company and you may not disclose the code then the boss can:

  • Pay you to have time to research / learn programming Arduino
  • Pay for a consultant which will sign the same non disclosure agreement.

But asking for free help without posting the code is not an option :slight_smile:

Just connected the POT output to the A3 pin of arduino.

Where are the other two POT contacts connected to ?

But when i copy the same function in the new program,
i'm able to read the various voltage at pin.
Please can anyone suggest what the problem must be?

If you are using the same circuit then the code must be different in some way but if you can't/won't post it then it is difficult help ? Do you call the function in the same way with the same parameters. How are the variables declared (global or local) ? Are you sure that the scope of the variables is correct ? Are you sure that the names of the variables are consistent ?