serial caracter not expected

First of all, must say that I'm newbie to electronics and Arduino.
I've spent a lot of time findind a solution to my problem.
It must have an easy explanation but I just cant find it.

It's as simple as this....

I write a number in serial port like this

Serial.write(5);

when I monitor serial port I get "f" caracter.....

Any idea????

Thanks in advance!!

It's as simple as this....

I write a number in serial port like this

Serial.write(5);

when I monitor serial port I get "f" caracter.....

Any idea????

You need to explain why you want to use a method that sends binary data (Serial.write()) to talk to a device that expects ASCII data (the Serial Monitor). You could also explain why you are surprised when the results are not what you expect.

If you want to have a '5' displayed then you need to use Serial.print(5, DEC) to display it as a decimal.

If you want to have a '5' displayed then you need to use Serial.print

Yes.

, DEC) to display it as a decimal.

No. The default for integer values is to display the value in base 10. So, the , DEC is not required. If you want to display in base 7 or base 22, then you need to use the second argument to define the base to use.

Thank you all,

It works fine now
Serial.write((byte)5);

I was using diferent baudrate speed in code and serial monitor...