Little background:
I am working on a project to run 2 stepper motors simultaneously using Matlab. I was able to run the 2 motors in Matlab using an Uno and a motorshield (after uploading the srv.pde. The srv.pde is required for the shield to work in my case.), but I wasn't able to run the motors simultaneously.
I tried I2C with an another Uno and using the Wire library (http://arduino.cc/en/Tutorial/MasterWriter) in addition to the AccelStepper library, I was able to run the motors simultaneously using the Arduino 1.0.2 software.
My question is:
Is there a way of adding the Wire and AccelStepper libraries to the srv.pde so that I can use I2C and AccelStepper in Matlab? Is there another way of running 2 motors simultaneously using Matlab?
void receiveEvent( int howMany)
{
while (Wire.available())
{
}
}
The master code, is the srv.pde and I added: #include <Wire.h> #include <AccelStepper.h>
and to the void loop(), I added
Wire.beginTransmission (100);
Do I need to end the transmission (I mean add Wire.endTransmission() to the code)? Or the transmission should automatically end when I disconnect the arduino?
Adding #include <AccelStepper.h> to the code didn't seem to have an effect, the 2 motors still don't run simultaneously. What do I have to do to fix this?