i need my stepper motor to continuously spin until i tell it otherwise, i'm a complete noob and have been trying for ages using the example code to do this but the motor just seems to jump back and forth allot. I'm using the NEMA-17 stepper.
#include <Wire.h>
#include <Adafruit_MotorShield.h>
#include "utility/Adafruit_MS_PWMServoDriver.h"
// Create the motor shield object with the default I2C address
Adafruit_MotorShield AFMS = Adafruit_MotorShield();
// Or, create it with a different I2C address (say for stacking)
// Adafruit_MotorShield AFMS = Adafruit_MotorShield(0x61);
// Connect a stepper motor with 200 steps per revolution (1.8 degree)
// to motor port #2 (M3 and M4)
Adafruit_StepperMotor *myMotor = AFMS.getStepper(200, 2);
void setup() {
Serial.begin(9600); // set up Serial library at 9600 bps
Serial.println("Stepper test!");
AFMS.begin(100); // create with the default frequency 1.6KHz
//AFMS.begin(1000); // OR with a different frequency, say 1KHz
myMotor->setSpeed(10); // 10 rpm
}
void loop() {
myMotor->step(1, FORWARD, INTERLEAVE);
}
Last edited by adafruit_support_bill on Mon Jun 20, 2016 4:04 pm, edited 1 time in total.
Reason:please use the </> button when submitting code. press </>, then paste your code between the [code] [/code] tags.
adafruit_support_bill wrote:Which NEMA17 stepper? What are you using to power it? How do you have it wired? Please post a photo showing your soldering and wiring to the shield.
Powering by USB is not going to work well work well. With the VIN jumper installed, motor power comes from the Arduino VIN pin. But when powering from USB, the only power that gets to the VIN pin is whatever can leak backwards through the Arduino's voltage regulator.
Also, the motor is designed for 12v operation, and USB only supplies 5v. You will probably see much better performance with a power supply in the 9v-12v range.
adafruit_support_bill wrote:Powering by USB is not going to work well work well. With the VIN jumper installed, motor power comes from the Arduino VIN pin. But when powering from USB, the only power that gets to the VIN pin is whatever can leak backwards through the Arduino's voltage regulator.
Also, the motor is designed for 12v operation, and USB only supplies 5v. You will probably see much better performance with a power supply in the 9v-12v range.
Do you have a link or something to where i can buy a uk power supply for the arduino? Thanks!