Arduino package for Matlab

조회 수: 3(최근 30일)
Marco 2011년 3월 3일
Does anyone used the arduino package for matlab? it is necessary to download a server on the Arduino board. For the IO package I found no problems. However, with the motor package this server"motorsrv.pde" cannot be compiled. In fact, it includes strings like: #include AFMotor.h #include ServoTimer1.h which refers to files that are not present in the downloadable folder. Any help is welcome! Thanks, Marco
  댓글 수: 1
Jan 2011년 3월 3일
Did you ask the author already?

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


Giampiero Campa
Giampiero Campa 2012년 1월 10일
Note that since mid 2011 the servo library now uses the built in timer library, so things are much easier, since you only have to download the servo library from here:
then uncompress it and stick the AFMotor directory into the arduino-1.X/libraries folder.
The last version of the MATLAB Support Package for arduino (aka Arduino IO Package) is available here:
Please note that there is a readme.txt file that can somehow guid you if you are unsure about how to start and use the package.

Kaustubha Govind
Kaustubha Govind 2011년 3월 3일
  댓글 수: 1
Samudra Haque
Samudra Haque 2011년 3월 28일
I felt your answer was very cryptic and confusing. Would it have taken a lot of your time if you spent time in actually writing a response in some detail so that others could understand what you meant?

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

Samudra Haque
Samudra Haque 2011년 3월 28일
Hi, I hope this might be useful: I was trying to compile and got confused but then spent some time digging through the README file (in the arduino_ml director of the MATLAB ARDUINOIO package, and got the package compiled easily. I am about to test it tomorrow, but if it works, here is the summary:
  • ARDUINO UNO - arduino-022
  • used ""
  • no changes to the code, only compiled
The motor shield is a shield to control dc, stepper and servo motor. Details are here: If you want to use the motor shield make sure do the following: 1) Download the servotimer library: then uncompress, and stick the ServoTimer1 directory into the arduino-00xx/libraries folder 2) Download the motor library: then uncompress, and stick the AFMotor directory into the arduino-00xx/libraries folder. It is also a very good idea to have a very good look at the Manual:
The motorsrv.pde file 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 results. This file is meant to be used with the Motor Sield.
From the Arduino IDE, go to File > Sketckbook > Open, locate the file motorsrv.pde, (in the motorsrv folder) and open it. Then, select File -> Upload to I/O Board and wait for the "Done Uploading" message.
At this point the motorsrv.pde file is uploaded and you can close the IDE, which is not needed anymore until you remove the shield.
% attach servo #1 a.servoAttach(1);
% return the status of all servos a.servoStatus;
% rotates servo #1 of 45 degrees a.servoWrite(1,45);
% reads angle from servo #1 val=a.servoRead(1);
% sets speed of motor 4 as 200/255 a.motorSpeed(4,200)
% prints the speed of all motors a.motorSpeed;
% runs motor 1 forward a.motorRun(4,'forward');
% runs motor 3 backward a.motorRun(4,'backward');
% release motor 1 a.motorRun(4,'release');
% sets speed of stepper 1 as 10 rpm a.stepperSpeed(1,10)
% prints the speed of stepper 1 a.stepperSpeed(1);
% rotates stepper 1 forward of 100 steps in interleave mode a.stepperStep(1,'forward','double',100);
% rotates stepper 1 backward of 50 steps in single mode a.stepperStep(1,'backward','single',50);
% releases stepper 1 a.stepperStep(1,'release');

iqra uni
iqra uni 2012년 11월 4일
what is the difference in uploading the file motor.srv and adio.srv ??? i uploadedd adio srv it also runs the servo from matlab so what i need to upload both files or the adio is enough confused about it ????


Find more on MATLAB Support Package for Arduino Hardware in Help Center and File Exchange


Community Treasure Hunt

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

Start Hunting!

Translated by