stepper motor release on adafruit motorshiledV2

Hey everyone, after a bunch of research, I’m still having trouble with this issue. I simply want to de-energize my stepper motor after executing a move. I do not need it to hold position. So I have found a few things I thought would help but I’m clearly missing something.

I have tried putting the “release()” command in to no avail. I occasionally get an error depending on where I put it, and other times i dont get an error, but it still won’t de-engergize. sketch as follows.

This does everything but de-energize, turns on the LED, turns the motor and stops. Fairly simple setup.

#include <Wire.h>
#include <Adafruit_MotorShield.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);

//Naming the buttons
int buttonApin = 2;
int buttonBpin = 3;
int ledPin = 6;

void setup()
{

pinMode(ledPin, OUTPUT);
pinMode(buttonApin, INPUT_PULLUP);
pinMode(buttonBpin, INPUT_PULLUP);

myMotor->setSpeed(50); // 10 rpm

AFMS.begin(1600); // create with the default frequency 1.6KHz

}

void loop()
{
int sensorVal = digitalRead(2);
{
if (digitalRead(buttonApin) == LOW)
{
digitalWrite(ledPin, HIGH);
myMotor->step(100, FORWARD, DOUBLE);
digitalWrite(ledPin, LOW);
delay(500);
}
}

}

Please read this:-
How to use this forum
Because your post is breaking the rules about posting code.

I can't see any use of release() in that code?

Yup sorry about that. Ill throw it in where i have tried it but didn’t have success.

#include <Wire.h>
#include <Adafruit_MotorShield.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);

//Naming the buttons
int buttonApin = 2;
int buttonBpin = 3;
int ledPin = 6;


void setup() 
{
  
  pinMode(ledPin, OUTPUT);
  pinMode(buttonApin, INPUT_PULLUP);  
  pinMode(buttonBpin, INPUT_PULLUP);  

  
  myMotor->setSpeed(50);  // 10 rpm  

  AFMS.begin(1600);  // create with the default frequency 1.6KHz

  
 
}

void loop() 
{
   int sensorVal = digitalRead(2);
  { 
    if (digitalRead(buttonApin) == LOW)
    {
    digitalWrite(ledPin, HIGH);
   myMotor->step(100, FORWARD, DOUBLE);
   digitalWrite(ledPin, LOW);
   delay(500);
release()  //I have tried entering it here
    }
release()  //I have tried entering it here
  }
    
release()  //I have tried entering it here  
  
   

  }
void release()  //I have tried entering it here
}

Ok I think I got it sorted. Code as follows. Anyone see any issues with running it this way.

/* 
This is a test sketch for the Adafruit assembled Motor Shield for Arduino v2
It won't work with v1.x motor shields! Only for the v2's with built in PWM
control

For use with the Adafruit Motor Shield v2 
---->	http://www.adafruit.com/products/1438
*/


#include <Wire.h>
#include <Adafruit_MotorShield.h>


Adafruit_MotorShield AFMS = Adafruit_MotorShield(); 

Adafruit_StepperMotor *myMotor = AFMS.getStepper(200, 2);



//Naming the buttons
int buttonApin = 2;
int buttonBpin = 3;
int ledPin = 6;


void setup() 
{
  myMotor->setSpeed(50);  // 10 rpm 
  AFMS.begin(1600);  // create with the default frequency 1.6KHz
  myMotor->release();
  
  pinMode(ledPin, OUTPUT);
  pinMode(buttonApin, INPUT_PULLUP);  
  pinMode(buttonBpin, INPUT_PULLUP);  



  
 
}

void loop() 
{
   int sensorVal = digitalRead(2);
    myMotor->release();
  { 
    if (digitalRead(buttonApin) == LOW)
    {
    digitalWrite(ledPin, HIGH);
   myMotor->step(100, FORWARD, DOUBLE);
   digitalWrite(ledPin, LOW);
   delay(500);
    }
    
  }
}

Which stepper motor (link to it’s datasheet).
Adafruit’s v2 motorshield is NOT a stepper motor driver, but a brushed motor driver.
Only some stepper motors work sort off with this shield.
Leo…