2 Contact Stepper Control Help

Hi all, first project. Been working on it for some time now, but am missing something. All I want to accomplish is to drive a stepper motor using variations of two contacts. Any help would be appreciated. I finally got it to compile, but it’s not doing what I intended.

//  Built using elements from Arduino examples, custom code, and from Arduino Workshop guru assistance.
//  [Project 1] – Stepper Motor Direction Control Using 2 digital inputs with variable interlocking approvals.
//  Button inputs will eventually be replaced with LDR's
//  McMullen October 2015.

#include <Stepper.h>

const int button_1 = 1;
const int button_2 = 2;

//int buttonState_1 = 0;
//int buttonState_2 = 0;



const int stepsPerRevolution = 512; 


// initialize the stepper library on pins 4 through 7
Stepper myStepper (stepsPerRevolution, 4, 5, 6, 7);

void setup() 
{
  // set the speed at 2 rpm:
  myStepper.setSpeed(15);

  // initialize the serial port:
  Serial.begin(9600);
   pinMode(button_1, INPUT);
   pinMode(button_2, INPUT);
}

void loop() 
{
{
  
    if (digitalRead(button_1)==LOW && digitalRead(button_2)==LOW) // Chassis on target
    {
    delay(100);
    }    // Wait's a tenth of a second before looking for new inputs.
   
}
{
        if (digitalRead(button_1)== LOW && digitalRead(button_2)==HIGH) // Chassis is below target
        { 
         myStepper.step(1);   // Track up
        }
}
{         
        if (digitalRead(button_1)== HIGH && digitalRead(button_2)==LOW) // Chassis is above target
        { 
         myStepper.step(-1);   // Track down 
        }
         
}
}

We need some more details on the hardware you are using.

Weedpharma

Scott1980:
but it's not doing what I intended.

I wonder what it was that he intended?

You have a few pairs of redundant {} - remove them as they are just confusing.

You seem to have one of your buttons connected to pin 1 which is Serial Tx. Move your button to a different pin.

Have you been able to get your motor to move with some simple test code?

Describe what the program posted actually does and what you would like it to do.

Post a link to the datasheet for your motor and a link to the datasheet for your stepper driver board.
Describe your motor power supply - volts and amps.

...R
Stepper Motor Basics

Robin2:
You have a few pairs of redundant {} - remove them as they are just confusing.

You seem to have one of your buttons connected to pin 1 which is Serial Tx. Move your button to a different pin.

Stepper Motor Basics

Thank you everybody for your reply's. Robin, moving my button off of pin 1 was what I was missing. It works now.

THANKS!!!!!