Firstly, I created a connection with Raspberry Pi in MATLAB and sent a matrix
ThemeCopy
pc = serialdev(r,'/dev/serial0');
dataToSend = [22;4;5;6;7];
byteStream = typecast(dataToSend, 'double');
Then,I will deploy the following code to Raspberry Pi to read data from the serial port and send some data to the serial port
ThemeCopy
function tablelook()%#codegen
rsp = serialdev(r,'/dev/serial0');
output = read(rsp,5,'double');
(I obtain my final 0/1 through the five input parameters and output it to the serial port)
Finally,I read the data in MALTAB
ThemeCopy
But I get wrong data during transmission,all of them is zeros.
Can you give me some advice?
Many thanks,
Bang