sending data via serial port

2 ビュー (過去 30 日間)
anas qazaz
anas qazaz 2013 年 4 月 2 日
hi,all i have matrix that contain 10 elements such as: 2 4 77 33 etc,i want to send them to serial port with delay 4 second between them in such away i send 2 after 4 second i send 4 after another 4 second i send 77.how i can do this plzzzz help,suggest,give ideas
thanks in advance

回答 (1 件)

Mahdi
Mahdi 2013 年 4 月 2 日
To put a time interval in your script, I would suggest looking at the pause() function.
In your example, you can use pause(4) to stop the loop for 4 seconds.
So it would be
Matrix1=[2 4 77 ...]
for i=1:length(Matrix1)
A=Matrix1(i)
% Send A to serial port
pause(4)
end

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by