Reading Serial Data from Arduino using Simulink

Hello,
Complete newbie to Simulink and serial data here. I've been trying to get Simulink to read a very simple output made of a single 8 bit integer from an Arduino, but have been getting a bunch of huge readings on my display on Simulink. I know it's receiving the Arduino data because these gibberish readings change as the input from the Arduino changes, but I don't know what's causing them to be so misread. I've attached snapshots of both Arduino and Simulink codes here. First I thought it was a baud issue, so I made sure both were set at 9600. Then I made sure the number outputted is an 8 bit integer, since that's what Simulink is expecting. Still, to no avail. The block I'm using in Simulink is Serial Receive from the Instrument Control Toolbox.
I'd really appreciate any tips/advice/suggestions please. Thanks!

답변 (1개)

Kiran Felix Robert
Kiran Felix Robert 2021년 2월 8일

0 개 추천

Hi Bashhar,
Refer Use Serial Communications with Arduino Hardware documentation to learn more about Simulink Support packages for Arduino.
Refer the reference Tutorial, Send and Recieve Serial Data Using Arduino Hardware for an example for serial communication and Model settings.
Also check the COM port configurations to make sure that the values are same with respect to the model.

카테고리

도움말 센터File Exchange에서 Arduino Hardware에 대해 자세히 알아보기

질문:

2021년 2월 6일

답변:

2021년 2월 8일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by