Connecting to arduino - timeout

9 Ansichten (letzte 30 Tage)
ulrich
ulrich am 8 Mär. 2012
Kommentiert: Brais Gonzalez am 22 Nov. 2017
Hallo!
I tried to connect matlab to my arduino uno getting the following reply:
>> a= arduino('COM6')
Attempting connection ........
Warning: A timeout occurred before the Terminator was reached.
??? 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.
What I did before is:
downloaded the matlab arduino softwar in the folder ...toolbox\matlab
opened matlab as administrator
set a path to the folder ...toolbox\matlab\arduino
pluged in the arduino
and typed the command (see above).
And than there comes the error message. :-(
With the arduino 1.0 software the arduino works fine. I uploaded several files to blink the diode and it worked fine.
What I did not understand is that in the error message of matlab it saies "...running either srv.pde...". How can I start the srv.pde software?
Thanks for your help!
Ulrich

Akzeptierte Antwort

Grufff
Grufff am 8 Mär. 2012
The srv.pde "software" is actually a server script which you need to upload and run on the Arduino. It is this script which enables Matlab to communicate with and control the Arduino.
The srv.pde sketch is supplied in the Matlab Arduino support package here:
You upload it to the board just like you would any other standard sketch. Full instructions are contained in the readme file that comes with the support package... quoted snippet here:
"UPLOAD SRV.PDE (OR ADIOSRV.PDE) TO THE ARDUINO BOARD (to be done only once):
The srv.pde (or adiosrv.pde) is the "server" program that will continuously run on the microcontroller. It listens for MATLAB commands arriving from the serial port, executes the commands, and, if needed, returns a result.
The following instructions are needed to upload the srv.pde file into the controller's flash memory. Note that if you don't have the motor shield and don't plan to use it, then you can UPLOAD THE ADIOSRV.PDE file instead the instructions are the same, except for the folder location).
As long as no other file is uploaded later, this step does not need to be repeated anymore, and the package can be used as soon as the board is connected to the computer..... "
Follow the instructions in the readme, these will walk you through uploading srv.pde to your Arduino and should solve your problem.
  2 Kommentare
ulrich
ulrich am 8 Mär. 2012
Thanks Grufff!
with the adiosrv.pde it works well (uploading the srv.pde resulted in a lot of error messages). anyway, it works! great!
I read out the acceleration data of a sensor but could only get about 120 results per second which is not enough for my purposes. Do you maybe know it that's the best i can get or is there a way to make the analogRead faster? Maybe there's a way to write the data into some memory on the arduino first before reading it form matlab after the measurement is done?
Cheers,
Ulrich
Brais Gonzalez
Brais Gonzalez am 22 Nov. 2017
The PWM outputs provide 50,000 values per second. You could make a program that sends the data obtained, to pins 2-13 and obtain the information in the form of PWM.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

kartik p
kartik p am 28 Jun. 2014
i tried using the motor pde..but while compiling..it shows me an error dat AFMOTOR.h file is missing...u mean to say for matlab to control the servos via arduino i need to have adafruit motorshield??nd if no..den wich pde must be loaded into arduino for controlling servos?coz i tried with adiosrv.pde but matlab says no pde related to servos found so no action taken....

Kategorien

Mehr zu MATLAB Support Package for Arduino Hardware finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by