Arduino package for Matlab

2 次查看(过去 30 天)
Marco
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

回答(4 个)

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: http://www.mathworks.com/matlabcentral/fileexchange/32374
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 "ServoTimer1-fixedv13.zip"
  • no changes to the code, only compiled
MOTOR SHIELD:
The motor shield is a shield to control dc, stepper and servo motor. Details are here: http://www.ladyada.net/make/mshield/ If you want to use the motor shield make sure do the following: 1) Download the servotimer library: http://www.ladyada.net/media/mshield/ServoTimer1-fixedv13.zip then uncompress, and stick the ServoTimer1 directory into the arduino-00xx/libraries folder 2) Download the motor library: http://www.ladyada.net/media/mshield/AFMotor-08_12_2009.zip 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: http://www.ladyada.net/make/mshield/use.html
UPLOAD MOTORSRV.PDE TO THE ARDUINO BOARD:
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.
MOTOR SHIELD EXAMPLE:
% 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 ????

类别

Help CenterFile Exchange 中查找有关 Arduino Hardware 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by