using values returned by Serial.read()

hey all, i wanted to send an integer value from 1 arduino to another using cc2500 wireless module.

The thing is, when i send say 1(int value), using Serial.print(), it converts it to a string and sends it through the Tx. This is recived by the other arduinos buffer and i use

incoming=Serial.read();

to read it. now incoming has the ascii value 49(int value).

is ther any way to convert it back to 1 without predefined chartor sumtin? in short, i want to send interger data by Serial.print() and i want to receive it as an integer value, not the ascii equivalent.

i don't want to have to this all the time with my arduino.. may slow it down and use resources unnecessarily

http://www.lcc.ctc.edu/faculty/dderkacht/Mathematics/ASCIItoInteger/ASCIItoInteger.htm

i figured just subtract 48 from the ascii value, but this only works for integer values. But suppose i want to send a charector say '~'?

Would you post a part of your sketch. If I send an integer one it will send a one and not an ascii one.

you can just send the raw data without converting it to ascii. int i=1; Serial.print(i,BYTE); would send just a 1 rather than a 49.

I wouldn't worry about conversion overhead if i were you, the arduino can convert it way quicker than the serial send time. I usually use ascii where I can to make it easier to debug with a serial monitor.

If I need to transmit a multi-digit number i might use raw BYTE's to save re-parsing the ascii at the other end but that's just coding laziness on my part, not efficiency.

thank you, i dint know i could use BYTE to that effect. :)