Adafruit motorshild 2 and release()

Adafruit Ethernet, Motor, Proto, Wave, Datalogger, GPS Shields - etc!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
schmartguy1
 
Posts: 22
Joined: Tue Jan 28, 2014 3:37 pm

Adafruit motorshild 2 and release()

Post by schmartguy1 »

Hi. i'm using a 6 wire .9 deg stepper with the Version 2 shield. I'm able to run the stepper but the release command doesn't seem to work. The application I'm designing uses sensor data input to tweak x and y positioning. once moved the mechanics will hold their position and I need to release the stepper during long waits.

I used a While lop to see if the release command works. it doesn't. what am I doing wrong?


Here's is the code:

Code: Select all

#include <Wire.h>
#include <Adafruit_MotorShield.h>
#include "utility/Adafruit_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(400, 2);  //.9 deg steps

void setup() {
  Serial.begin(9600);           // set up Serial library at 9600 bps
  Serial.println("Stepper test!");

  AFMS.begin();  // create with the default frequency 1.6KHz
  //AFMS.begin(1000);  // OR with a different frequency, say 1KHz

 Adafruit_StepperMotor *myMotor = AFMS.getStepper(400, 2);
 // define stepper#2
  
 myMotor->setSpeed(150);  // 150 rpm
}



void loop() 
{
  int count=0;
  Serial.println("DoubleStep Forward");
  myMotor->step(100, FORWARD, DOUBLE);
  Serial.println("DoubleStep Backward"); 
  myMotor->step(100, BACKWARD, DOUBLE);
  Serial.println("Release");
  void release(void);                                        //still doesn't release
  Serial.println("wait");
  while(count<1000)
  {  Serial.println(count);
     count++;   }
}  
Regards

Notso schmartguy1
Last edited by adafruit_support_bill on Mon Mar 24, 2014 12:45 pm, edited 1 time in total.
Reason: Please use the 'code' button when submitting code - click 'code' and paste your code between the tags.

User avatar
adafruit_support_bill
 
Posts: 88087
Joined: Sat Feb 07, 2009 10:11 am

Re: Adafruit motorshild 2 and release()

Post by adafruit_support_bill »

Code: Select all

  void release(void);                                        //still doesn't release
This is not a motor command. You need to tell it which motor you want to release:

Code: Select all

  myMotor->release();

User avatar
schmartguy1
 
Posts: 22
Joined: Tue Jan 28, 2014 3:37 pm

Re: Adafruit motorshild 2 and release()

Post by schmartguy1 »

u-da man Bill. many thanx. schmarterguy1

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino Shields from Adafruit”