how to send a single integer value from Matlab to arduino?
8 次查看(过去 30 天)
显示 更早的评论
I want to send it via Serial Communication
0 个评论
回答(1 个)
Ashitha Nair
2020-2-11
编辑:Ashitha Nair
2020-2-12
Your matlab code could be as follows
s = serial('COM8','BaudRate',9600); %creates a serial object
flushinput(s) %this discards all previous s values
fopen(s);
fwrite(s,255); % allows you to send a single int here, I'm sending 255
This should be paired with a read method, in your arduino IDE. Make sure that you type in the correct COM port and baud rate. Baud rate should be the same (in your serial object as well as the arduino).
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 MATLAB Support Package for Arduino Hardware 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!