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

조회 수: 3 (최근 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

댓글을 달려면 로그인하십시오.

커뮤니티

더 많은 답변 보기:  Power Electronics Community

카테고리

Help CenterFile Exchange에서 Arduino Hardware에 대해 자세히 알아보기

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by