how to send multiple integer values from matlab to arduino ide?

1 回表示 (過去 30 日間)
Shlok Sharma
Shlok Sharma 2020 年 1 月 22 日
コメント済み: Hugo Pontes 2020 年 8 月 5 日
i have established connection between arduino ide and matlab,how can i send multiple integer values as an array of list from matlab to arduino.

回答 (1 件)

Charan Jadigam
Charan Jadigam 2020 年 3 月 23 日
Hi,
To write arrays to Arduino from MATLAB open a serial connection and connect it to Arduino and then write using ‘fwrite’. For establishing serial communication,
arduino = serial('COMx');
set(arduino,'DataBits',8);
set(arduino,'StopBits',1);
set(arduino,'BaudRate',9600);
set(arduino,'Parity','none');
fopen(arduino);
and write using
data=1:9;
fwrite(Arduino,data,'uint16');
  1 件のコメント
Hugo Pontes
Hugo Pontes 2020 年 8 月 5 日
Hi, sorry I have a question:
If one uses uint16 as the data type what is the structure of the communication? Is it startbit, 8 databits,stopbit,startbit,8 databits,stopbit? Or startbit,16 data bits, stop bit ? Im using an FPGA and my Rs232 communication works for 8 bits but not for 16 bits so I suspect that the structure is not the second one I mentioned

サインインしてコメントする。

コミュニティ

カテゴリ

Help Center および File ExchangeMATLAB Support Package for Arduino Hardware についてさらに検索

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by