Serial communication with PHP

soup:

Something minor I noticed about your code; it obviously had nothing to do with your problem, but was something to keep in mind (for this small sketch, it really doesn't matter - but for larger projects, it might matter a lot)...

You declare the variable "inByte" for reading from the serial port as an integer...[stop]

soup - I am not asking the following of you, but if you know, please chime in...


Ok - I just went to the Serial.read() function definition on the Arduino site:

I just noticed that it reads:

"Returns...the first byte of incoming serial data available (or -1 if no data is available) - int"

Why isn't the return value of this function a byte, instead of an int? Aren't integers on the Arduino defined as 2 bytes long?:

http://arduino.cc/en/Reference/Int

So - why does Serial.read() return an int, and why doesn't the documentation match up? Also, what is the return value type for Serial.available() - it isn't mentioned in the documentation, either?

:-?