How to use variables as input for Data size(N) of Raspberry Pi I2C Master Read block?
1 view (last 30 days)
Hello, I am reading characters of more than 32 bytes from a slave(Arduino UNO/nano in my case). Since the slave can send only 32 bytes of data at one instance, the data is received as different packets. The raspberry pi acts as master and it mentions the packet number to the slave. Since the last may not have 32 bytes of data, the data size should be varying as per the remaining bytes of data to be received. The above functionality is achieved using the mscript as per below script.
no_bytes = (data_length - (packet_number * 32));
% Check the size of data to be received
if (no_bytes > 32)
receive_data = char(read(US_sensor, 32));
receive_data = char(read(US_sensor, no_bytes));
I want to achieve the same operation in Simulink using I2C Master read block. How can I set Data size as an variable which will be updated as the simulink runs in realtime.