From: Sean on
Dr. Campa from MathWorks recently sent me his ArduinoIO program, and I'm having problems connecting to my board from Matlab.

I uploaded the accompanying sketch to my arduino and tested that it was uploaded correctly via the arduino IDE... everything is fine at this point.

When I try to open a connection to the arduino via Matlab, I'm getting some errors:

>> a=arduino('COM3')
Warning: Unable to save path to file 'C:\Program Files\MATLAB\R2010a\toolbox\local\pathdef.m'.
> In savepath at 162
In arduino>arduino.arduino at 22
Attempting connection ......
Warning: A timeout occurred before the Terminator was reached.
??? Error using ==> arduino>arduino.arduino at 100
Connection unsuccessful, please make sure that the Arduino is powered on, running either 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.

I don't think I am worried about the pathdef.m error, but it's the timeout that I can't figure out what the problem is. I think that it stems from fwrite(a.aser,[57 57],'uchar'); which is soliciting the board to respond with "1". The .m file checks for this response with chk=fscanf(a.aser,'%d'); but since chk is empty, the script returns the "Connection unsuccessful ..." error and closes the connection to the arduino.

If anyone familiar with ArduinoIO has some insight on this problem, I'd love to hear it. I tried contacting Dr. Campa about this to no avail.
From: John D'Errico on
"Sean " <sdvhw9(a)mail.mizzou.edu> wrote in message <i2dt4a$vl$1(a)fred.mathworks.com>...
> Dr. Campa from MathWorks recently sent me his ArduinoIO program, and I'm having problems connecting to my board from Matlab.
>
> I uploaded the accompanying sketch to my arduino and tested that it was uploaded correctly via the arduino IDE... everything is fine at this point.
>
> When I try to open a connection to the arduino via Matlab, I'm getting some errors:
>
> >> a=arduino('COM3')
> Warning: Unable to save path to file 'C:\Program Files\MATLAB\R2010a\toolbox\local\pathdef.m'.

It sounds as if you don't have write access to this directory.

John
From: Sean on
"John D'Errico" <woodchips(a)rochester.rr.com> wrote in message <i2eio3$nof$1(a)fred.mathworks.com>...
> "Sean " <sdvhw9(a)mail.mizzou.edu> wrote in message <i2dt4a$vl$1(a)fred.mathworks.com>...
> > Dr. Campa from MathWorks recently sent me his ArduinoIO program, and I'm having problems connecting to my board from Matlab.
> >
> > I uploaded the accompanying sketch to my arduino and tested that it was uploaded correctly via the arduino IDE... everything is fine at this point.
> >
> > When I try to open a connection to the arduino via Matlab, I'm getting some errors:
> >
> > >> a=arduino('COM3')
> > Warning: Unable to save path to file 'C:\Program Files\MATLAB\R2010a\toolbox\local\pathdef.m'.
>
> It sounds as if you don't have write access to this directory.
>
> John

Right, I changed the permissions on pathdef.m right after posting the original. The main problem I'm having is getting the code to connect to the hardware.
From: Sean on
I found a solution for anyone that has had the same problem. I uploaded a simple sketch that blinks pin 13 and sends a value of "1" through serial. As expected, the led starts blinking once the sketch is uploaded. I open a connection in MATLAB and the led blinking stops, so I press the reset button on the board and sure enough, the 1's start coming through and the led starts blinking again.

I try the ArduinoIO program again and reset the board right after initializing the arduino object. Success
From: Sam on
"Sean " <sdvhw9(a)mail.mizzou.edu> wrote in message <i2gf3c$dg3$1(a)fred.mathworks.com>...

Sean,

Where did you find the contact information for Dr. Campa? We are trying to change our lab over from LabView to Matlab, and have done quite a lot so far using Instrument Control Toolbox (and no Arduino board). However, we are looking into using the board for some applications. Do you know if it can be used with the instrument control toolbox? I would be interested in getting the ArduinoIO file from Dr. Campa as well. Thanks.