Cannot connect MATLAB to Arduino board due to connection timeout error -> [??? Error using ==> arduino>arduino.arduino at 102]

조회 수: 2 (최근 30일)
Hi, I am trying to connect MATLAB to an Arduino Duemilanove using the MATLAB IO Support Package. It did work in the past (couple of weeks ago) using this board but now for some reason it does not want to connect to the board. When I use the "a=arduino('COM4')" it appears with the error:
??? Error using ==> arduino>arduino.arduino at 102
Connection unsuccessful, please make sure that the Arduino is powered on, running either srv.pde,
adiosrv.pde or mororsrv.pde, and that the board is connected to the indicated serial port. You might also
try to unplug and re-plug the USB cable before attempting a reconnection.
The argument at line 102 of the arduino.m file is as follows:
% exit if there was no answer
if isempty(chk)
delete(a);
error('*Connection unsuccessful, please make sure that the Arduino is powered on, running either srv.pde, adiosrv.pde or mororsrv.pde, and that the board is connected to the indicated serial port. You might also try to unplug and re-plug the USB cable before attempting a reconnection.*');
end
I have uploaded adiosvr.pde to the target board and closed down the Arduino IDE (as recommended by the readme.txt file). I have hunted on the web high and low through forums and so on but cannot find a viable solution to my problem. I am fairly new to MATLAB and the IDE language but I am an engineering student working on my dissertation and this is kind of imperative to the whole success of it. It's so frustrating that it was working and now it isn't. I haven't changed or removed anything.
ANY help would be greatly, greatly appreciated.
Regards,
Euan Millar
  댓글 수: 1
Gautam Vallabha
Gautam Vallabha 2012년 4월 9일
What changed in the last couple of weeks? Are you using a different board?
(make sure that COM4 is the correct port for the Arduino. If you have other serial USB devices connected to your system, a new COM port may have gotten assigned to the Duemilanove).

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

답변 (3개)

Aminat
Aminat 2012년 4월 9일
I have the same problem. I got it to work okay in the IDE environment but for some reason it's not working in the Matlab environment. Please reply when you find any answers.

Aminat
Aminat 2012년 4월 9일
Hi! I figured out the answer...you have to establish a connection between the IDE and Matlab to control the serial port. The details are at this link/in the readme for matlab support package.

Brais Gonzalez
Brais Gonzalez 2017년 11월 21일
Answer for Error using arduino (line 104) Warning: Unsuccessful read: A timeout occurred before the Terminator was reached.
The answer is: 1 In the Arduino software(IDE). You need write the code, which you find in file "adioes.pde" There are three files adio, adioe, adioes. A for analog D for digital I for input O for Output E for encoder S for Servo. If you need a Servo o a encoder, you need put the code more complete adioes. 2 Compile this code and send to arduino. Close the IDE 3 To open matlab and to write a=arduino("COMxx") 4 You has finalized the Arduino instalation

카테고리

Help CenterFile 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!

Translated by