Arduino To Arduino Serial Communication Without A Library
Answer : Not sure it has a bearing on your problem or not, but I can't help highlight this: wait: while((tmp = serialReceive()) != 2){ goto wait; } That has to be the the most evil piece of code ever written in the history of mankind. I'm sorry, but it is. while((tmp = serialReceive()) != 2); is all you need. Or if you must be "pedantic": while((tmp = serialReceive()) != 2) { continue; } There is never any call to use goto (I don't know why it was ever even included in C), and certainly not to re-run a while loop that is going to re-run itself anyway. In your receiver you are using dynamic memory, and doing it extremely badly. First you start out with a pointer char *s; Then when you receive a data character you pass that pointer to your array_concat() routine as the source for where to copy data from: s = array_concat(s, strlen(s), tmp); You are at that point asking it for the length of the string in an undefine...