I'm working on a project where I want to be able to program a robotic arm in Arduino using MatLab. I've used the Arduino Uno with an Adafruit Motor Shield V2.3 and the OWI Robotic Arm Edge kit. The arm is perfectly assembled and works just fine with the standard remote it comes with. All of the connections with the Adafruit Motor Shield are correctly placed, and the shield has been soldered onto pins that connect to the Uno.
I am absolutely positive that the physical and electronic setup is correct. However, whenever I try to move the motors attached to the shield, none of them register. Below is my code:
a = arduino('COM3', 'Uno', 'Libraries', 'Adafruit\MotorShieldV2') shield = addon(a, 'Adafruit\MotorShieldV2') addrs = scanI2CBus(a,0); dcm = dcmotor(shield, 1); dcm.Speed = 0.01; start(dcm) dcm2 = dcmotor(shield, 2); dcm2.Speed = 0.2; start(dcm2) dcm3 = dcmotor(shield, 3); dcm3.Speed = 0.2; start(dcm3) dcm4 = dcmotor(shield, 4); dcm4.Speed = 0.2; start(dcm4)
I believe the issue is with the third line:
addrs = scanI2CBus(a,0);
When I run the code, the shield has the following properties:
shield = motorshieldv2 with properties: Pins: A4(SDA), A5(SCL) I2CAddress: 96 (0x60) PWMFrequency: 1600 (Hz)
So while the I2C address should be 0x60, the actual value of the
addrs variable is a 2x1 cell instead of 0x60, as the project demands/specifies as seen in the workspace:
I'm almost certain that this is the reason behind why none of the motors are being registered, but how can I fix it?
Thanks in advance for any assistance! Please let me know if I need to supply more information.