analogRead problem

I’ve tried searching for people with the same problem but didn’t find the same exact one so here I am asking directly

Sorry for any english mistakes it’s not my first language

Whenever I try to test analogRead I get weird results with symbols questions marks, letters and the occasionnal number instead of a number between 0 and 1023

I’ve tried reseting my arduino and changing the wire I was using but it was useless

The code I’ve been using for my tests is :

void setup() {
Serial.begin(6900);
int a = analogRead(A2);
Serial.println(a);
}

I attached to this publication a spreadsheet with all the results I’ve gotten when connecting directly every analog entry to 5V and both GND entries one at a time of course (sorry for the low quality)

tableau pb.PNG

Serial.begin(6900);

Did you mean 9600?

I made a mistake in my code...

It explains the crazy results... I really feel stupid right now

I've corrected it but even though now I get numbers I still don't have 0 (except when using A2) when connecting my analog entries to the ground... it changes every time i get numbers around 300 (once it even was 34600 !)

it's the same when connecting stuff to the 5V except with higher values generally
Again A2 is the only one with normal results

once it even was 34600

If you got a reading that high from an analogRead, (and an int) you've got very serious problems

Try one of the analog examples in the IDE which will give you continuous reads .

I would add a resistor to ground on your analog input ( say 10k?).

Note that by default the A/D uses the 5v line as it’s reference , so if that is noisy, it will affect your results .

Following your advice I've tried one of the IDE exemples for Analog (AnalogInOutSerial to be more precise)

I get results between 500 and 1023 I can't seem to get any lower results...

I don't think it's normal but my understanding of circuits is not the best...