MATLAB Answers

How to read sensor readings from serial port using simulink's serial receive block? I'm trying to plot it but I think there's some issue with datatype

6 views (last 30 days)
Talha Yousuf
Talha Yousuf on 24 Jul 2017
Commented: Walter Roberson on 24 Jul 2017
Whats the datatype of data received from serial port, I'm trying to receive sensor data via serial port, it reads correctly on arduino IDE serial window but when I read data from simulink's serial receive block, it is very unrealistic. What should be settings for this serial receive block?

  1 Comment

Walter Roberson
Walter Roberson on 24 Jul 2017
How is the data being sent? If you using serial receive block then most likely you have the arduino encoding the values as text, which requires that you receive several characters of text and convert the several characters to a numeric value by interpreting or parsing them. I speculate that instead you are reading individual bytes as if were uint8 and trying to use those as if they were the readings themselves.

Sign in to comment.

Answers (0)

Sign in to answer this question.

Translated by