MATLAB Answers


sending data via serial port

Asked by anas qazaz on 2 Apr 2013

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 i can do this plzzzz help,suggest,give ideas

thanks in advance


Log in to comment.

1 Answer

Answer by Mahdi
on 2 Apr 2013

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)
% Send A to serial port


Log in to comment.

Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!