MATLAB Answers

Thomas
0

Problem with Adafruit Motor Shield

Asked by Thomas
on 9 Sep 2013
Latest activity Commented on by Steve
on 10 Nov 2014
I am attempting to control two stepper motors using an arduino board and an adafruit motor shield.
I have successfully installed all IO files, .pde files, and can connect my arduino (plus motor shield) to matlab. I have followed the readme file very closely. However, when the connection is established, matlab lists off servos 2-69, instead of the 2 associated with my motor shield. Additionally, no commands will operate my stepper, servos or motors. The motor shield works perfectly when using the Arduino IDE, I can control all steppers, servos and motors. I have also controlled servos, motors, LEDs, etc just using the arduino and matlab (no motor shield connected), using the audiosrv.pde file. Below are the lines I get in the command window.
if true
%code
a=arduino('COM3')
Attempting connection .............
Motor Shield Script detected !
Arduino successfully connected !
%
a =
%
arduino object connected to COM3 port
Motor Shield Server running on the arduino board
%
Servo 2 is DETACHED
Servo 3 is DETACHED
Servo 4 is DETACHED
Servo 5 is DETACHED
Servo 6 is DETACHED
Servo 7 is DETACHED
Servo 8 is DETACHED
Servo 9 is DETACHED
Servo 10 is DETACHED
Servo 11 is DETACHED
Servo 12 is DETACHED
Servo 13 is DETACHED
Servo 14 is DETACHED
Servo 15 is DETACHED
Servo 16 is DETACHED
Servo 17 is DETACHED
Servo 18 is DETACHED
Servo 19 is DETACHED
Servo 20 is DETACHED
Servo 21 is DETACHED
Servo 22 is DETACHED
Servo 23 is DETACHED
Servo 24 is DETACHED
Servo 25 is DETACHED
Servo 26 is DETACHED
Servo 27 is DETACHED
Servo 28 is DETACHED
Servo 29 is DETACHED
Servo 30 is DETACHED
Servo 31 is DETACHED
Servo 32 is DETACHED
Servo 33 is DETACHED
Servo 34 is DETACHED
Servo 35 is DETACHED
Servo 36 is DETACHED
Servo 37 is DETACHED
Servo 38 is DETACHED
Servo 39 is DETACHED
Servo 40 is DETACHED
Servo 41 is DETACHED
Servo 42 is DETACHED
Servo 43 is DETACHED
Servo 44 is DETACHED
Servo 45 is DETACHED
Servo 46 is DETACHED
Servo 47 is DETACHED
Servo 48 is DETACHED
Servo 49 is DETACHED
Servo 50 is DETACHED
Servo 51 is DETACHED
Servo 52 is DETACHED
Servo 53 is DETACHED
Servo 54 is DETACHED
Servo 55 is DETACHED
Servo 56 is DETACHED
Servo 57 is DETACHED
Servo 58 is DETACHED
Servo 59 is DETACHED
Servo 60 is DETACHED
Servo 61 is DETACHED
Servo 62 is DETACHED
Servo 63 is DETACHED
Servo 64 is DETACHED
Servo 65 is DETACHED
Servo 66 is DETACHED
Servo 67 is DETACHED
Servo 68 is DETACHED
Servo 69 is DETACHED
%
Servo Methods: servoStatus servoAttach servoDetach servoRead servoWrite
%
Encoder 0 is DETACHED
Encoder 1 is DETACHED
Encoder 2 is DETACHED
%
Encoder Methods: encoderStatus encoderAttach encoderDetach encoderRead encoderReset
%
The speed of motor number 1 is set to: 0 over 255
The speed of motor number 2 is set to: 0 over 255
The speed of motor number 3 is set to: 0 over 255
The speed of motor number 4 is set to: 0 over 255
The speed of stepper number 1 is set to: 0 over 255
The speed of stepper number 2 is set to: 0 over 255
%
DC Motor and Stepper Methods: motorSpeed motorRun stepperSpeed stepperStep
%
Serial port and other Methods: serial flush roundTrip
%
EDU>> a.stepperSpeed(1,50)
EDU>> a.stepperSpeed(2,50)
EDU>> a.stepperStep(2,'backward','single',50)
EDU>> a.stepperStep(1,'backward','single',50)
EDU>> a.servoStatus(1)
Error using arduino/servoStatus (line 928)
Unallowed value for servo number, the value must be an integer going from 2 to 69

  0 Comments

Sign in to comment.

1 Answer

Answer by Thomas
on 10 Sep 2013
 Accepted Answer

Solved. Version 2.0 motor shield is not currently compatible with Matlab IO.

  1 Comment

Steve
on 10 Nov 2014
Is it compatible now? I need to know because i intend purchase one for use on matlab.

Sign in to comment.