Hey Sandy,
I want to say you have done a wonderful job with this project. Ive been following it for a while and finally decided to give it a try. Purchased all the part and had no issues until when it came to controlling the motors from the polargraph controller.
Im using an Arduino Mega 2560 and Adafruit Motorshield V2 with Nema 17 200 step motors. I can make the motors turn with the adafruit sample code. I believe I was able to integrate the new adafruit library into the server because it uploads and reads Ready in the serial port. Below is the code from the configuration.ino:
// 1. Adafruit motorshield
#include <Wire.h>
#include <Adafruit_MotorShield.h>
#include "utility/Adafruit_PWMServoDriver.h"
Adafruit_MotorShield AFMS = Adafruit_MotorShield();
const int stepType = INTERLEAVE;
Adafruit_StepperMotor *afMotorA = AFMS.getStepper(motorStepsPerRev, 1);
Adafruit_StepperMotor *afMotorB = AFMS.getStepper(motorStepsPerRev, 2);
void forwarda() { afMotorA->onestep(FORWARD, stepType); }
void backwarda() { afMotorA->onestep(BACKWARD, stepType); }
AccelStepper motorA(forwarda, backwarda);
void forwardb() { afMotorB->onestep(FORWARD, stepType); }
void backwardb() { afMotorB->onestep(BACKWARD, stepType); }
AccelStepper motorB(forwardb, backwardb);
void configuration_motorSetup()
{
// no initial setup for these kinds of motor drivers
}
From the controller I can connect to the serial port and I get the green light however there is no movement from the motors when I un-pause the queue. So I feel like its an issue with the V2 motorshield? Let me know if you have any insight on this. or maybe I'm just forgetting something.
Thanks and great job on your work
Xander
|