For my project, I am communicating a Raspberry Pi with an Arduino using a serial connection. On the Raspberry Pi side I am deploying a MATLAB simulink model on it.
Raspberry PI ->sends string to Arduino
Arduino => receieves the string =>sends a different string back
Pi => receives that string and parses it
The code that Arduino uses to send data is
Serial.print("variable length string");
The code to read in data on the Pi is:
int size_of_buffer = 100;
fdread = read(fd, read_data, size_of_buffer );
Then I am parsing some data from what I read. I am not sure the size of the data the Arduino sends. Is there anything wrong with the reading and writing? The problem is that the program crashes on the Raspberry Pi side.