フィルターのクリア

Simulink Serial Receive Block needs numeric char, logic

2 ビュー (過去 30 日間)
Jarren Berdal
Jarren Berdal 2023 年 5 月 19 日
回答済み: Sachin 2023 年 6 月 7 日
Hi so I am trying to use serial receive block to receive serial from an arduino. I am trying to fun Simulink Serial Receive Block from instrument control tool box, when I run the model in hardware mode I get an error that the input needs numeric, char, logic. When I use regular simulation mode I can use the Serial.write() line to output serial. But once I run the model on hardware mode it does not work. Do I have to convert my serial into bytes and then use serial.write on hardware mode?

回答 (1 件)

Sachin
Sachin 2023 年 6 月 7 日
Hi Jarren
I understand that you are getting errors while using Simulink Serial Receive Block.
You may try converting the data into bytes and then use the Serial.write(). Serial.write() takes input as byte data.
To send data from Simulink to an Arduino over a serial connection, you can use the serial transmit block from the Instrument control toolbox. This block accepts input signals of various data types, including scalar numeric, etc.
Refer to MATLAB “Getting Started with Arduino ” documentation
I suggest you refer to this MathWorks documentation “Send and Receive Data Using Arduino Hardware”
Thanks

カテゴリ

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

タグ

製品


リリース

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by