uip_appdata is (essentially) an array of bytes (or unsigned chars) and you cannot assign an int directly to it. Since, in Arduino/AVR land an int is two bytes you can split it apart and send those to two parts (HIBYTE and LOBYTE) as two bytes in uip_appdata but you do not need a library to do this - its one or two lines of code. And then you will need to reassemble those bytes on the other side - and if your intended data size will be larger than an int (or unsigned int) you will need to use a larger data type which uses more bytes.
In C there is no such thing as a "string" - there are arrays; what you might be thinking of as a string is likely an array of chars, bytes or unsigned chars.
Interestingly the Arduino environment (19) does not complain about the following code for me:
- Code: Select all
int foo = 8;
memcpy(uip_appdata, foo, 2);
Greg