I don't understand how to use this command: Serial.write (buf, len), that buf must be an array right? can it be an integer array or must it be a char array, and can it be used to send a string?? I am communicating from arduino uno to arduino mega. Now I can send many chars and receive and assemble them as one string. And I can succesfully transmit several integers with a lower value than 255
Some examples, can I do the following ?:
Serial.Write("Hello world", 11); ??? (hello world being 11 chars and thus 11 bytes)
Serial.Write(array[x], 2); ??? (sending one value of an integer array which is 2 bytes)
And if I can send a 2 byte integer from uno to mega, how can I assemble these 2 separate bytes into the old integer it used to be? I know I cant use +.
I also tried to break down a three digit integer into seperate integers from 0-9 and assemble them on the other side
so
Serial.write ( val / 100); array[0] = val * 100;
Serial.write ( val / 10 ); array[1] = val * 10;
Serial.write ( val / 1 ); array[2] = val ;
value = array[0] + array[1] + array [2]
this only works for like 80%, sometimes it skippes a 10 or a 100.
But can someone tell me how to use Serial.write with arrays??