Reading Serial Data from Arduino using Simulink

4 ビュー (過去 30 日間)
Bashhar Byrouthy
Bashhar Byrouthy 2021 年 2 月 6 日
回答済み: Kiran Felix Robert 2021 年 2 月 8 日
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 日
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.

カテゴリ

Help Center および File ExchangeModeling についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by