Trouble with function Serial.write

Hello everyone, I'm trying to use serial communication to transmit an integer number, that's not the problem because it works as expected except for one thing, when I send a number greater than 255 for example 256 then I see 0 in my monitor, I guess the reason for this is that there is only one byte available and then any number greater than 255 will not fit, my question is ¿Is there any way solve this or another function that allows me to send numbers greater than 255?

By the way, I have tried with Serial.print but then I receive a series of bytes, for example, if I send 148 what I see in the monitor is:

49 52 56

with some lines of codes, I could transform this in 148 of course but I wonder if there is a simpler way using some function like Serial.write.

Thank you in advance to all!

49 52 56

aka '1', '4', '8'

Yeah I know, but what I want is to have 148 inside an int variable! :(

What happens when you subtract '0' from each value?

'1' - '0' = 1 '4' - '0' = 4 '8' - '0' = 8

Hint: you're not the first.

The serial input basics tutotial may help.

@OP

Are you executing the following/similar sketch so that the Serial Monitor shows --
49
52
56

in its OutputBox when you enter 148 from the InputBox (with No line ending option)?

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

void loop() 
{
  byte n = Serial.available();
  if(n !=0)
  {
    byte x = Serial.read();
    Serial.print(x);
    Serial.println();
  }
}

sm140.png

Now, try to modify the above codes so that the Serial Monitor shows 148 in its OutputBox.

sm141.png

sm140.png

sm141.png