wrong values returned from uno

Hi, since few days, my serial return unusal values from analogRead pins (all of them). The value returned begins with any possible symbol on the first row ( like: $ or § or 4... ), then i get my value between 0 and 1023 (i.e.: &38 or *255).
I don't even know if there is a real trouble or a bad configuration, but i cannot use analogRead anymore with such values. I'm on Mac, I swap on maverick (Great idea !!!) at the same time troubles begin, i really think it is linked but i don't understand how.

Does someone have any idea ?

Does someone have any idea ?

Without seeing your code?
No, I doubt it.

The value returned begins with any possible symbol on the first row

The first row of what?

I don't think it is about the code, i tried different sketches, even this, it doesn't work.

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

void loop() {
Serial.println(analogRead(A0)/4);
Serial.write(analogRead(A0)/4);

}

Some of sketches i triied are in the book, they were working when I save them, but now, they cannot get correct values. And by "first row" I meant the first symbol on each line of the serial.

What output are you expecting from the following code? And what output do you get (maybe copy and paste from of the output from serial monitor)?

  Serial.println(analogRead(A0)/4);
  Serial.write(analogRead(A0)/4);

Specifically, what do you expect to see from this?

  Serial.write(analogRead(A0)/4);

(BTW, did you notice the use of code tags?)

Welcome to the Forum. It would be useful for you to read Nick Gammon's posting guides which appear at the top of this Forum, especially when posting code. Using code tags make it easier for us to help you.

Also, looking at the code that you did post, there's a pretty good chance it is about the code. If you post all of your code, we'd have a better chance to be of help.

In fact, this line come from a project of the arduino project book. I added the Serial.println to check my values. The expected output of the Serial.write was "Processing".

econjack:
Welcome to the Forum. It would be useful for you to read Nick Gammon's posting guides which appear at the top of this Forum, especially when posting code. Using code tags make it easier for us to help you.

Thanks, I'll do.

Also, looking at the code that you did post, there's a pretty good chance it is about the code. If you post all of your code, we'd have a better chance to be of help.

But there is ALL the code, even more cause I added the Serial.println...

Processing is a programming language. It can be used to write PC programs that send data to Arduino or receive data from Arduino, usually over the USB serial connection.

In this case, it sounds like the Arduino program is sending the values read from the analog input over the serial port so it can be received by a Processing program on the PC and then displayed in some way - maybe as a graph.

Is there anything in the project book about a Processing program to go along with the Arduino program?

Yes, the book's project is to change the colour of the arduino's logo (on pc) by changing the value of the potentiometer. This value is supposed to be between 0 and 255 to be transmitted.

OK, so as suggested look at what the Serial.write method does, as compared with Serial.print. This will explain what you are seeing on the serial monitor.

Yes it comes from the write line... Sorry of wasting your time, i'll try less stupid question next time. Thank a lot !

Sorry of wasting your time, i'll try less stupid question next time.

I think you'll find most people here genuinely want to help and don't view questions as being stupid. The only posters here who might get short-changed are those who don't even try to find a solution on their own, first. I don't think anyone feels that way about your questions.