AccelStepper W/ Button

Hi,
I am using a Teensy 3.6 to control 2x Nema 34 Stepper motors through two drivers. I have the STEP and DIR pins connected to the Teensy along with a UP and Down Button.

I would like the motors to move up while holding the UP button and the motors to move down while holding the down button.
I am having issues writing the correct code for this, as it results in the motor going very slow & the motor is jumping/skipping.

Thanks

As you have not posted your program or told us (in detail please) what happens when you run the program it is impossible to suggest an improvement.

...R
Stepper Motor Basics
Simple Stepper Code

Robin2:
As you have not posted your program or told us (in detail please) what happens when you run the program it is impossible to suggest an improvement.

...R
Stepper Motor Basics
Simple Stepper Code

Hi Robin yes i have,

When the button is held the motor skips at a very slow speed.

When it is on a loop to just run it runs fast and smooth.

Here is an example of my code

#include <AccelStepper.h>

AccelStepper stepper(1, 2, 3);
int up=4;


void setup()
{  

  pinMode(up,INPUT_PULLUP);
 
  stepper.setMaxSpeed(1000);
   stepper.setSpeed(50);    
}

void loop()
{  
  if (digitalRead(up)==LOW)
  {
   stepper.runSpeed();
   stepper.run();
   
}}

bradmcco:
Here is an example of my code

What do you mean by "example of my code" ?

Why not just post the actual program?

You don't need both runSpeed() and run() in this

   stepper.runSpeed();
   stepper.run();

Choose one or the other. run() uses acceleration and runSpeed() does not.

...R