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
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');