2 bytes serial communication?

[code]// I want to define bytes instead of char but if I do that, arduino
// raises “Invalid conversion from “byte” to “char”” in this part Serial.readBytes(buffer,2);
// If I use char then I cannot convert to integer the value that arduino read from the
// Serial monitor. atoi(buffer) donot give us the reasonable response when I enter a number
// bigger than 100. I dont know why…
//How can I read the two bytes with the Serial.readBytes and convert the value integer

char buffer[2];
int incomingbyte = 0;

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

void loop(){
if(Serial.available() > 0){
Serial.readBytes(buffer,2);
a = atoi(buffer);
Serial.println(a);
}
}[/code]

Hello.

It is a little unclear if you are trying to combine the two bytes you read to a single value. Could you try explaining in more detail what you are trying to do? What is the format of the bytes you are receiving and how are you trying to convert them?

- Jeremy