Arduino package for Matlab
4 views (last 30 days)
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
Giampiero Campa on 10 Jan 2012
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.
Samudra Haque on 28 Mar 2011
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
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 on 4 Nov 2012
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 ????