Wire.send(value), what is the datatype of the value?

HI All

I have some questions about this particular function.

For the wire.h library, the reference document (http://www.arduino.cc/en/Reference/WireSend) shows that the value for the Wire.send() should be byte. However, in most of the applications, an integer instead of a byte is sent. Does the library converts the data type to byte automatically? If so, which byte of the 2 will be sent first? The MSB or the LSB?

Thanks in advance!!

If you are passing an integer (int) to Wire.send(byte) then the integer is implicitly converted to a byte at the call site by the compiler. Implicit conversions are platform dependent. For a positive integer you will get the LSB but with an obvious loss of precision casting from the int to a byte. However, a byte is unsigned and if the integer is negative you will not get the LSB but it will not be what you expected. On my platform passing integer -37 to a function with a byte parameter results in an implicit conversion to the value 219.