How to check connection status with arduino?

조회 수: 14 (최근 30일)
Omkar Bhanap
Omkar Bhanap 2018년 9월 29일
댓글: Walter Roberson 2018년 9월 29일
I am creating a graphical user interface of servo motor control. For this, I am using MATLAB support package for Arduino. I need to check the connection status of my Arduino with my PC. Is there any command for checking the connection status?
  댓글 수: 3
Omkar Bhanap
Omkar Bhanap 2018년 9월 29일
No, I don't want to generate any C/Cpp code to run, not trying for any standalone application.
Walter Roberson
Walter Roberson 2018년 9월 29일
It is not a matter of generating C/C++ code for standalone application.
The arduino runs a program. The program it runs can either be C/C++ code that you provide (perhaps having generated it, perhaps having written it yourself, perhaps having found a convenient source code online), or it can be a generic MATLAB-specific program that listens for commands from MATLAB, executes them, and returns the results. "Stand-alone" would be for the case where you wanted the arduino to execute without a MATLAB program communicating with it.
Having C/C++ code devoted to the exact task on hand can give much higher performance, and leaves open the possibility that the arduino could monitor conditions and report back only when needed, and leaves open the possibility of (for example) advancing only to the motor stop, or advancing to a particular location or until a particular input was recognized.
If you use the generic connection from MATLAB, you have to send queries and mostly single motor steps, always checking on the MATLAB side whether you had gone far enough. This is much slower than having the arduino handle things, as the communications between the arduino and MATLAB is not fast. The polling loop is, if I recall correctly, limited to at most 1 Khz by the USB connection, and usually gets much less with 40-ish Hz seeming to be typical.
The reason all of this matters is that the method of checking for connectivity is going to depend upon whether you are running a custom program on the Arduino or if you are running the generic program.
... Or is the real question not about testing to see if communications with the Arduino has been lost, and is instead a question about proving to see which COM port the arduino is living on ?

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

답변 (0개)

카테고리

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

태그

제품


릴리스

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by