Stepper motors and momentary buttons

Hello,

I am in the process of building the code for making a stepper motor go up and down. I'm having difficulty in getting the stepper to go forward when a momentary button is pressed and only stop when the momentary button is pressed again. My problem is in getting the stepper to go an unspecified number of steps, the code for the button works fine (works with an LED).

Any help would be much appreciated, thank you!

Please read the "How to use this forum" post and follow the directions. Post the code, using code tags, and describe or post links to the motor, motor driver and power supply.

How do you suppose the motor will know to move by an "unspecified number of steps"?

Welcome to the forum Clickity.

Show us your current sketch. Please use code tags. Use the </> icon in the posting menu.

[code] Paste sketch here. [/code]

Show us a good schematic of your circuit. Show us a good image of your wiring.

.

Clickity:
My problem is in getting the stepper to go an unspecified number of steps,

Tell it to move one step
Repeat until the next button press arrives

...R
Stepper Motor Basics
Simple Stepper Code

Thank you for your replies. I knew not posting my code would get me into trouble, I received and error for length, abbreviated version here;

#include <string.h>
#include <Arduino.h>
#include <SPI.h>
#if not defined (_VARIANT_ARDUINO_DUE_X_) && not defined (_VARIANT_ARDUINO_ZERO_)
  #include <SoftwareSerial.h>
#endif
#include "Adafruit_BLE.h"
#include "Adafruit_BluefruitLE_SPI.h"
#include "Adafruit_BluefruitLE_UART.h"

#include <Wire.h>
#include <Adafruit_MotorShield.h>
#include <AccelStepper.h>
#include <Adafruit_MCP23017.h>
#include "Adafruit_MCP23017.h"

Adafruit_MCP23017 mcp;

#include "BluefruitConfig.h"

    #define FACTORYRESET_ENABLE         1
    #define MINIMUM_FIRMWARE_VERSION    "0.6.6"
    #define MODE_LED_BEHAVIOUR          "MODE"


Adafruit_BluefruitLE_SPI ble(BLUEFRUIT_SPI_CS, BLUEFRUIT_SPI_IRQ, BLUEFRUIT_SPI_RST);

// A small helper
void error(const __FlashStringHelper*err) {
  Serial.println(err);
  while (1);
}

// function prototypes over in packetparser.cpp
uint8_t readPacket(Adafruit_BLE *ble, uint16_t timeout);
float parsefloat(uint8_t *buffer);
void printHex(const uint8_t * data, const uint32_t numBytes);

// the packet buffer
extern uint8_t packetbuffer[];

int Button_B1 = 0;
int OLDButton_B1 = 0;
int Button_B2 = 0;
int OLDButton_B2 = 0;
int Button_B3 = 0;
int OLDButton_B3 = 0;
int Button_B4 = 0;
int OLDButton_B4 = 0;

int led1 = 0;                        //21  writes to Top led
int led2 = 1;                        //22  writes to 2nd led
int led3 = 2;                        //23  writes to 3rd led
int led4 = 3;                        //24  writes to 4th led
int led5 = 4;                        //25  writes to Bottom led
int BlueButton = 5;                  //reads from Blue Button
int GreenButton = 6;                 //reads from Green Button
int AmberButton = 7;                 //reads from Amber Button

Adafruit_MotorShield AFMStop(0x61); // Rightmost jumper is closed... 60 is Default address, no jumpers
Adafruit_StepperMotor *myStepper1 = AFMStop.getStepper(200, 2);

int BB = 0;
int GB = 0;
int AB = 0;

int BB2 = 0;
int OLDBB2 = 0;
int GB2 = 0;
int OLDGB2 = 0;
int AB2 = 0;
int OLDAB2 = 0;


int x = 0;

unsigned long CMStepperUp;
unsigned long PSMStepperUp = 0;
unsigned long MBSStepperUp = 25;  //milliseconds

unsigned long CMStepperDown;
unsigned long PSMStepperDown = 0;
unsigned long MBSStepperDown = 25;  //milliseconds


unsigned long CMFlashUp;
unsigned long PSMFlashUp = 0;
unsigned long MBSFlashUp = 25;  //milliseconds

unsigned long CMFlashDown;
unsigned long PSMFlashDown = 0;
unsigned long MBSFlashDown = 25;  //milliseconds


void setup(void)
{
  while (!Serial);  // required for Flora & Micro
  delay(500);

  Serial.begin(115200);
  Serial.println(F("Goofy Begin"));
  Serial.println(F("-----------------------------------------"));

  /* Initialise the module */
  Serial.print(F("Initialising the Bluefruit LE module: "));

  if ( !ble.begin(VERBOSE_MODE) )
  {
    error(F("Couldn't find Bluefruit, make sure it's in CoMmanD mode & check wiring?"));
  }
  Serial.println( F("OK!") );

  if ( FACTORYRESET_ENABLE )
  {
    /* Perform a factory reset to make sure everything is in a known state */
    Serial.println(F("Performing a factory reset: "));
    if ( ! ble.factoryReset() ){
      error(F("Couldn't factory reset"));
    }
  }

  ble.echo(false);

  Serial.println("Requesting Bluefruit info:");
  ble.info();

  Serial.println(F("Please use Adafruit Bluefruit LE app to connect in Controller mode"));
  Serial.println(F("Then activate/use the sensors, color picker, game controller, etc!"));
  Serial.println();

  ble.verbose(false);

  while (! ble.isConnected()) {
      delay(500);
  }

  Serial.println(F("******************************"));

  // LED Activity command is only supported from 0.6.6
  if ( ble.isVersionAtLeast(MINIMUM_FIRMWARE_VERSION) )
  {
    // Change Mode LED Activity
    Serial.println(F("Change LED activity to " MODE_LED_BEHAVIOUR));
    ble.sendCommandCheckOK("AT+HWModeLED=" MODE_LED_BEHAVIOUR);
  }

  // Set Bluefruit to DATA mode
  Serial.println( F("Switching to DATA mode!") );
  ble.setMode(BLUEFRUIT_MODE_DATA);

  Serial.println(F("******************************"));

  mcp.begin(); // use default address 0  
  AFMStop.begin(); // Start the top shield
  myStepper1->setSpeed(400.0);

  mcp.pinMode(BlueButton, INPUT);
  mcp.pinMode(GreenButton, INPUT);
  mcp.pinMode(AmberButton, INPUT);

  mcp.pinMode(led1,OUTPUT);
  mcp.pinMode(led2,OUTPUT);
  mcp.pinMode(led3,OUTPUT);
  mcp.pinMode(led4,OUTPUT);
  mcp.pinMode(led5,OUTPUT);

 
  LEDsAllOn ();
  delay (1000);
  LEDsAllOff();
  
}


void loop(void)
{

   CMStepperDown = millis();
   CMStepperUp = millis();
   CMFlashDown = millis();
   CMFlashUp = millis();
   
  uint8_t len = readPacket(&ble, BLE_READPACKET_TIMEOUT);
  if (len == 0) return;
  
  // Buttons
  if (packetbuffer[1] == 'B') {
    uint8_t buttnum = packetbuffer[2] - '0';
    boolean pressed = packetbuffer[3] - '0';
       
  
   if (pressed) {
    if(buttnum == 1 ) {{
      Button_B1 = 1 - Button_B1;}
    if(Button_B1 == 1 && OLDButton_B1 == 0){
      LEDsAllOn ();
      Serial.println(F("Button 1 pressed, All LEDs On"));
      delay (50);
      }
    if (Button_B1 == 0 && OLDButton_B1 == 1){
      Serial.println("Button 1 released,  All LEDs Off");
      LEDsAllOff ();
      delay(50);
      }
      Serial.println(F("OLDButton_B1 = Button_B1;"));
      OLDButton_B1 = Button_B1;
      }
    
   if(buttnum == 2 ) {{
      Button_B2 = 1 - Button_B2;}
    if(Button_B2 == 1 && OLDButton_B2 == 0){
       Serial.println("Button 2 Pressed, Jog down");
       LEDsFlashDown();
       //LEDsFlashDown(); 
       //LEDsFlashDown();
       delay(100);
       myStepper1->step(200, FORWARD, DOUBLE); //Move Foward 1 mm
       delay (50);
    }
    if (Button_B2 == 0 && OLDButton_B2 == 1){
      Serial.println("Button 2 Released, All Leds off");
      LEDsAllOff();
      delay(50);
      }      
      Serial.println(F("OLDButton_B2 = Button_B2;"));
      OLDButton_B2 = Button_B2;
      }
  
   //button 3
 if(buttnum == 3 ) {{
      Button_B3 = 1 - Button_B3;}
     if (Button_B3 == 1 && OLDButton_B3 == 0){
      Serial.println("Button 3 Pressed jog up");
      LEDsFlashUp();
      }
 
     if(Button_B3 == 0 && OLDButton_B3 == 1){
      Serial.println("Button 3 Released");
      LEDsAllOff();
      delay(50);
      }
      OLDButton_B3 = Button_B3;
      }
           
  }     
 }
 
}


 void LEDsFlashUp(){
  Serial.println (F("LEDsFlashUp void"));
  if (CMFlashUp - PSMFlashUp >= MBSFlashUp) {
    PSMFlashUp += MBSFlashUp;
  mcp.digitalWrite (led1, LOW);
  delay(5);
  mcp.digitalWrite (led5, HIGH);
  delay(75);
  mcp.digitalWrite (led4, HIGH);
  delay(5);
  mcp.digitalWrite (led5,LOW);
  delay(75);
  mcp.digitalWrite (led3, HIGH);
  delay(5);
  mcp.digitalWrite (led4, LOW);
  delay(75);
  mcp.digitalWrite (led2, HIGH);
  delay(5);
  mcp.digitalWrite (led3, LOW);
  delay(75);
  mcp.digitalWrite (led1, HIGH);
  delay(5);
  mcp.digitalWrite (led2, LOW);
  delay(75);
  mcp.digitalWrite (led1, LOW);
  delay(1);
  }
 }

 void SingleStepUp(){
  Serial.println (F("StepperUp void")); 
   if (CMStepperUp - PSMStepperUp >= MBSStepperUp) {
    PSMStepperUp += MBSStepperUp;
   myStepper1->step(1, FORWARD, DOUBLE);
    }
   }

  void SingleStepDown(){
  Serial.println (F("StepperDown void")); 
   if (CMStepperDown - PSMStepperDown >= MBSStepperDown) {
    PSMStepperDown += MBSStepperDown;
   myStepper1->step(1, BACKWARD, DOUBLE);
    }
   }

I am using an Arduino Uno, an Adafruit Motor Shield V2, a Bluefruit le Sheild, and an MCP20317. I have 3 external buttons that I had to delete from the code so I don’t receive the length error. I don’t have a good schematic, pictures attached.

Button 3 is the one I’m trying to get the voids to loop, I am not using the motor to test the looping until I know I can get it to stop.

I’m thinking that if I can get the LEDsFlashDown void to loop, then I can loop a single step of the stepper until the button is pressed again (as Robin2 suggested). When I use while, or do while, loops the second button press is not read and the loop doesn’t stop.

Don’t use WHILE or FOR for anything that takes more than (say) a couple of millisecs. Let loop() do the iteration and organize your code so loop() can repeat hundreds or thousands of times per second.

That means getting rid of ALL the delay()s. Have a look at how millis() is used to manage timing without blocking in several things at a time

…R

Yeesh, I'm not sure i can point to the exact problem, but I can sure look at a few things in there that are red flags:

  1. delay() - Unless you really want absolutely nothing to happen, don't use this set a variable to millis() + (a delay) and then set a conditional if (millis() > variable)

  2. I see in your ledflashup function, you're essentially just changing the pins individually, I'm guessing the delay() you're using there is to wait for the I2C bus to keep up (otherwise you may get errors) I would completely re-write this function to simply write the whole data register at once (no more delays, much faster execution, and it drops to 3 lines of code) Here's a good source on this: http://tronixstuff.com/2011/08/26/tutorial-maximising-your-arduinos-io-ports/

You may want to just skip using the Adafruit libraries for this. While they may implement this hardware in a way that makes it easier for the newbie, it's likely slow and is at fault at least partially for your problem.

  1. The settings in your loop() first calls millis() 4 times, each time you call it, you will get a different number. Do it this way:
long unsigned clock = millis();
CMStepperDown = clock;
CMStepperUp = clock;
CMFlashDown = clock;
CMFlashUp = clock;

I'll be honest, I'm not actually sure you need this many different clocks running around, are you actually modifying these elsewhere in the program? If not, just use one line and call it the clock.

I would probably not break your functions into a stepup and a stepdown separate function, I know it seems logical to do, but there's a lot of extra code execution in there that's extra.

  1. in your if (pressed) I would drop all the nested "ifs" in there, and use a switch/case.

FWIW, once you clean up this code, just the optimization may solve your problem. Let us know how it goes!

Hello again,

Thank you for your replies they were very helpful.

I am having two problems at this point;

I did end up getting the motor to run continuously at the push of a button, and then stop at the second push of the button. However, it is extremely slow. Is there a way around this?

Secondly, I have three external buttons that are acting like they are being continuously pressed. The thing is that they were working before lunch; press button, turn light on, then press button again, turn light off. After lunch I come back, turn it back on, and it's now looping through the voids of the three external buttons. No, no one messed with my stuff.

The external buttons are Normally Open, connected to COM and MCP inputs 5, 6, 7.

Again, abbreviated code because of length:

int Button_B1 = 0;
int OLDButton_B1 = 0;
int Button_B2 = 0;
int OLDButton_B2 = 0;
int Button_B3 = 0;
int OLDButton_B3 = 0;
int Button_B4 = 0;
int OLDButton_B4 = 0;

int led1 = 0;                        //21  writes to Top led
int led2 = 1;                        //22  writes to 2nd led
int led3 = 2;                        //23  writes to 3rd led
int led4 = 3;                        //24  writes to 4th led
int led5 = 4;                        //25  writes to Bottom led
int BlueButton = 5;                  //reads from Blue Button
int GreenButton = 6;                 //reads from Green Button
int AmberButton = 7;                 //reads from Amber Button

Adafruit_MotorShield AFMStop(0x61); // Rightmost jumper is closed... 60 is Default address, no jumpers
Adafruit_StepperMotor *myStepper1 = AFMStop.getStepper(200, 2);

int BB = 0;
int GB = 0;
int AB = 0;

int BB2 = 0;
int OLDBB2 = 0;
int GB2 = 0;
int OLDGB2 = 0;
int AB2 = 0;
int OLDAB2 = 0;

int j = 0;

int stepCount =  0;

unsigned long PreviousOnBoardLEDMillis = 0;
unsigned long currentMillis = 0;

unsigned long PreviousLED1Millis = 0;

const int LEDDuration = 300;  //number of millisecs that the LEDs are on 
const int onBoardLEDInterval = 500;

const int LED1Interval = 500;
const int LED2Interval = 500;
const int LED3Interval = 500;
const int LED4Interval = 500;
const int LED5Interval = 500;

byte led1state = LOW;

void setup(void)
{
  while (!Serial);  // required for Flora & Micro
  delay(500);

  Serial.begin(115200);
  Serial.println(F("Goofy Begin"));
  Serial.println(F("-----------------------------------------"));

  mcp.begin(); // use default address 0  
  AFMStop.begin(); // Start the top shield
  myStepper1->setSpeed(400.0);  
  
  mcp.pinMode(BlueButton, INPUT);
  mcp.pinMode(GreenButton, INPUT);
  mcp.pinMode(AmberButton, INPUT);

  mcp.pinMode(led1,OUTPUT);
  mcp.pinMode(led2,OUTPUT);
  mcp.pinMode(led3,OUTPUT);
  mcp.pinMode(led4,OUTPUT);
  mcp.pinMode(led5,OUTPUT);

  LEDsAllOn ();
  delay (1000);
  LEDsAllOff();

}

void loop()
{
   BB = mcp.digitalRead(BlueButton);
   GB = mcp.digitalRead(GreenButton);
   AB = mcp.digitalRead(AmberButton);

   long unsigned clock = millis();
   currentMillis = clock;

      //UpdateLED1();
      //UpdateLED2();
      //UpdateLED3();
      //UpdateLED4();
      //UpdateLED5();
      
      
      appButtons();
      green_Button();
      amber_Button();
      blue_Button();
      contStepForward();

  uint8_t len = readPacket(&ble, BLE_READPACKET_TIMEOUT);
  if (len == 0) return;
  

} // end loop

void blue_Button(){
  if (BB == 0){
     Serial.println(F("Blue Button Pressed"));
     {BB2 = 1 - BB2;}
    if (BB2 == 1 && OLDBB2 == 0){ 
      delay (25);
      j = 2;
      delay(2);
      }
    if (BB2 == 0 && OLDBB2 == 1){
      Serial.println(F("Blue Button Released"));
      j = 0;
      delay(25);
      }
      OLDBB2 = BB2;
      }
    } //end blue_Button
    
void green_Button(){
  if (GB == 0){
      Serial.println(F("Green Button Pressed"));
      {GB2 = 1 - GB2;}
     if (GB2 == 1 && OLDGB2 == 0)
       {     
       delay (25);
       LEDsFlashDown();
       delay(2);
       }
    if (GB2 == 0 && OLDGB2 == 1){
       Serial.println(F("Green Button Released"));
       LEDsAllOff();
       delay(25);
       }
       OLDGB2 = GB2;
       }
       } // end green_Button
       
 void amber_Button(){
   if (AB == 0){
       Serial.println(F("Amber Button Pressed"));
       {AB2 = 1 - AB2;}
      if (AB2 == 1 && OLDAB2 == 0){ 
        delay (25);
        LEDsAllOn();
        delay(2);
        }
      if (AB2 == 0 && OLDAB2 == 1){
        Serial.println(F("Amber Button Released"));
        LEDsAllOff();
        delay(25);
        }
        OLDAB2 = AB2;
        }
      }
        
void appButtons(){
  // Buttons
  if (packetbuffer[1] == 'B') {
    uint8_t buttnum = packetbuffer[2] - '0';
    boolean pressed = packetbuffer[3] - '0';

   if (pressed){
    switch (buttnum){
      case 1:{
        {Button_B1 = 1 - Button_B1;}
       if(Button_B1 == 1 && OLDButton_B1 == 0){
         LEDsAllOn ();
         Serial.println(F("Button 1 Pressed"));
         }
       if (Button_B1 == 0 && OLDButton_B1 == 1){
         Serial.println(F("Button 1 Released"));
         LEDsAllOff ();
         }
         OLDButton_B1 = Button_B1;
         break;
         }
    
      case 2: {
        {Button_B2 = 1 - Button_B2;}
       if(Button_B2 == 1 && OLDButton_B2 == 0){
         Serial.println(F("Button 2 Pressed"));
         LEDsFlashDown();
         myStepper1->step(200, BACKWARD, DOUBLE); //Move Foward 1 mm
         }
       if (Button_B2 == 0 && OLDButton_B2 == 1){
        Serial.println(F("Button 2 Released"));
        LEDsAllOff();
        }      
        OLDButton_B2 = Button_B2;
        break;
        }
        
      case 3: {
         {Button_B3 = 1 - Button_B3;}
       if(Button_B3 == 1 && OLDButton_B3 ==0){
        Serial.println(F("Button 3 Pressed"));
        LEDsFlashUp();
        }
       if(Button_B3 ==0 && OLDButton_B3 ==1){
        Serial.println(F("Button 3 Released"));
        LEDsAllOff();
        }
        OLDButton_B3 = Button_B3;
        break;
        }
     
      case 4: {
        {Button_B4 = 1 - Button_B4;}
       if(Button_B4 == 1 && OLDButton_B4 == 0){
        Serial.println(F("Button 4 Pressed"));
        //LEDsFlashDown();
        //contStepForward();
        j = 2;
         }
       if(Button_B4 == 0 && OLDButton_B4 == 1){
        Serial.println(F("Button 4 Released"));
        LEDsAllOff();
        j = 0;
        }
        OLDButton_B4 = Button_B4;
        break;
        } // end 4
       } // end buttnum    
      } // end pressed
     } // end packet buffer
    } // end appButtons

 void LEDsAllOn (){
  Serial.println (F("LEDsAllOn void"));
  mcp.digitalWrite (led1, HIGH);
  mcp.digitalWrite (led2, HIGH);
  mcp.digitalWrite (led3, HIGH);
  mcp.digitalWrite (led4, HIGH);
  mcp.digitalWrite (led5, HIGH);
    }
   
 void LEDsAllOff (){
  Serial.println (F("LEDsAllOff void"));
  mcp.digitalWrite (led1, LOW);
  mcp.digitalWrite (led2, LOW);
  mcp.digitalWrite (led3, LOW);
  mcp.digitalWrite (led4, LOW);
  mcp.digitalWrite (led5, LOW);
    }

void LEDsFlashDown(){
if(led5state == LOW){
    if (CMFlashDown - PSMFlashDown >= MBSFlashDown){
    PSMFlashDown += MBSFlashDown;
  mcp.digitalWrite (led5, LOW);
  delay(5);
  mcp.digitalWrite (led1, HIGH);
  delay(75);
  mcp.digitalWrite (led2, HIGH);
  delay(5);
  mcp.digitalWrite (led1,LOW);
  delay(75);
  mcp.digitalWrite (led3, HIGH);
  delay(5);
  mcp.digitalWrite (led2, LOW);
  delay(75);
  mcp.digitalWrite (led4, HIGH);
  delay(5);
  mcp.digitalWrite (led3, LOW);
  delay(75);
  mcp.digitalWrite (led5, HIGH);
  delay(5);
  mcp.digitalWrite (led4, LOW);
  delay(75);
  mcp.digitalWrite (led5, LOW);
  delay(1);
  
  PSMFlashDown += MBSFlashDown;
  }
  
 else {
 if (currentMillis - PSMFlashDown >= LEDDuration){
    PSMFlashDown += LEDDuration;
     }
    }
   }
  } //end flashdown 

 
  void UpdateLED1(){
   if(led1state == LOW){
   if (currentMillis - PreviousLED1Millis >= LED1Interval) {
   led1state = HIGH;
   PreviousLED1Millis += LED1Interval;
     }
    }
  else {
   if (currentMillis - PreviousLED1Millis >= LEDDuration){
    led1state = LOW;
    PreviousLED1Millis += LEDDuration;
     }
    }
   }

//did this for all 5 LEDs, removed for length errors

 /*  
  void LEDsFlashDown(){
    mcp.digitalWrite (led1, led1state);
    mcp.digitalWrite (led2, led2state);
    mcp.digitalWrite (led3, led3state);
    mcp.digitalWrite (led4, led4state);
    mcp.digitalWrite (led5, led5state);
  }
*/
  
void contStepBackward(){
  myStepper1->step(1, BACKWARD, DOUBLE);    
  }
 

void contStepForward(){
  if (j == 2){
  myStepper1->step(1, FORWARD, DOUBLE);
    }
  }

You still have lots of delay()s in your code so how can you expect it to run quickly.

...R

It's not using those delays for controlling the motor. Only delays in the code right now control a 5 LED sequence and the bounce on external push buttons, and those voids aren't being triggered at the same time as the motor void.

Clickity:
It's not using those delays for controlling the motor. Only delays in the code right now control a 5 LED sequence and the bounce on external push buttons, and those voids aren't being triggered at the same time as the motor void.

Hey, look at how the code progresses through your program. Every iteration of loop() has to contend with several delay()s in the functions that are called before contStepForward();

...R

Okay, so I went back through got rid of anything that wasn't needed to run the motor with the app button, it's still moving extremely slow, code below.

void loop()
{
   BB = mcp.digitalRead(BlueButton);
   GB = mcp.digitalRead(GreenButton);
   AB = mcp.digitalRead(AmberButton);

   long unsigned clock = millis();
   currentMillis = clock;

      appButtons();
      contStepForward();
      
/* Wait for new data to arrive */
  uint8_t len = readPacket(&ble, BLE_READPACKET_TIMEOUT);
  if (len == 0) return;
  
  /* Got a packet! */
  // printHex(packetbuffer, len);

} // end loop
      
void appButtons(){
  // Buttons
  if (packetbuffer[1] == 'B') {
    uint8_t buttnum = packetbuffer[2] - '0';
    boolean pressed = packetbuffer[3] - '0';

   if (pressed){
    switch (buttnum){
      case 1:{
        {Button_B1 = 1 - Button_B1;}
       if(Button_B1 == 1 && OLDButton_B1 == 0){
         LEDsAllOn ();
         Serial.println(F("Button 1 Pressed"));
         }
       if (Button_B1 == 0 && OLDButton_B1 == 1){
         Serial.println(F("Button 1 Released"));
         LEDsAllOff ();
         }
         OLDButton_B1 = Button_B1;
         break;
         }
    
      case 2: {
        {Button_B2 = 1 - Button_B2;}
       if(Button_B2 == 1 && OLDButton_B2 == 0){
         Serial.println(F("Button 2 Pressed"));
         //LEDsFlashDown();
         myStepper1->step(200, BACKWARD, DOUBLE); //Move Foward 1 mm
         }
       if (Button_B2 == 0 && OLDButton_B2 == 1){
        Serial.println(F("Button 2 Released"));
        //LEDsAllOff();
        }      
        OLDButton_B2 = Button_B2;
        break;
        }
        
      case 3: {
         {Button_B3 = 1 - Button_B3;}
       if(Button_B3 == 1 && OLDButton_B3 ==0){
        Serial.println(F("Button 3 Pressed"));
        k = 2;
        }
       if(Button_B3 ==0 && OLDButton_B3 ==1){
        Serial.println(F("Button 3 Released"));
        k = 0;
        }
        OLDButton_B3 = Button_B3;
        break;
        }
     
      case 4: {
        {Button_B4 = 1 - Button_B4;}
       if(Button_B4 == 1 && OLDButton_B4 == 0){
        Serial.println(F("Button 4 Pressed"));
        //LEDsFlashDown();
        //contStepForward();
        //LEDsAllOn();
        j = 2;
        //k = 2;
         }
       if(Button_B4 == 0 && OLDButton_B4 == 1){
        Serial.println(F("Button 4 Released"));
        //LEDsAllOff();
        j = 0;
        //k = 0;
        }
        OLDButton_B4 = Button_B4;
        break;
        } // end 4
       } // end buttnum    
      } // end pressed
     } // end packet buffer
    } // end appButtons

 void LEDsAllOn (){
  Serial.println (F("LEDsAllOn void"));
  mcp.digitalWrite (led1, HIGH);
  mcp.digitalWrite (led2, HIGH);
  mcp.digitalWrite (led3, HIGH);
  mcp.digitalWrite (led4, HIGH);
  mcp.digitalWrite (led5, HIGH);
    }
   
 void LEDsAllOff (){
  Serial.println (F("LEDsAllOff void"));
  mcp.digitalWrite (led1, LOW);
  mcp.digitalWrite (led2, LOW);
  mcp.digitalWrite (led3, LOW);
  mcp.digitalWrite (led4, LOW);
  mcp.digitalWrite (led5, LOW);
    }

void contStepBackward(){
    if (i == 2){
    myStepper1->step(1, BACKWARD, DOUBLE);
    Serial.println (F("1 step Backward"));  
    }
   }

void contStepForward(){
  if (j == 2){
  myStepper1->step(1, FORWARD, DOUBLE);
  Serial.println (F("1 step forward"));
    }
  }

Then I did a new sketch without the bluefruit shield, that one runs at a more normal speed, code below.

void loop()
{
   BB = mcp.digitalRead(BlueButton);
   GB = mcp.digitalRead(GreenButton);
   AB = mcp.digitalRead(AmberButton);

      amber_Button();
      contStepForward();

} // end loop

 void amber_Button(){
//Amber Button
   if (AB == 0){
       Serial.println(F("Amber Button Pressed"));
       {AB2 = 1 - AB2;}
      if (AB2 == 1 && OLDAB2 == 0){  
        j = 2;
        }
      if (AB2 == 0 && OLDAB2 == 1){
        Serial.println(F("Amber Button Released"));
        j = 0;
        }
        OLDAB2 = AB2;
        }
      } //end amber_Button
        
 void LEDsAllOn (){
  Serial.println (F("LEDsAllOn void"));
  mcp.digitalWrite (led1, HIGH);
  mcp.digitalWrite (led2, HIGH);
  mcp.digitalWrite (led3, HIGH);
  mcp.digitalWrite (led4, HIGH);
  mcp.digitalWrite (led5, HIGH);
    }
   
 void LEDsAllOff (){
  Serial.println (F("LEDsAllOff void"));
  mcp.digitalWrite (led1, LOW);
  mcp.digitalWrite (led2, LOW);
  mcp.digitalWrite (led3, LOW);
  mcp.digitalWrite (led4, LOW);
  mcp.digitalWrite (led5, LOW);
    }
 
void contStepBackward(){
    if (i == 2){
    myStepper1->step(1, BACKWARD, DOUBLE);
    Serial.println (F("1 step Backward"));  
    }
   }
 
void contStepForward(){
  if (j == 2){
  myStepper1->step(1, FORWARD, DOUBLE);
  Serial.println (F("1 step forward"));
    }
  }

And I am a newbie, so using a bluefruit shield without the Adafruit config and packet parser isn't really an option, unless there is an awesome Github library somewhere...?

I am still having trouble with the external push buttons being read continuously, but I'm fairly sure that's already in another forum thread.

Again, thank you for all your input.

Clickity:
Then I did a new sketch without the bluefruit shield, that one runs at a more normal speed, code below.

If this was my problem I would make a new program with nothing but the stepper motor code in it and get that to work as needed.

Then I would add other elements, one at a time, being careful to test at every stage to see that the stepper continues to perform as required.

Unfortunately there is no guarantee that you can add several different libraries together without interference. Partly because the authors often don't take care to use the Arduino resources efficiently and partly because the Arduino doesn't have many resources.

...R