How to Control a Stepper Motor

Hello I was wondering how to properly write a code to control the up down functions of a stepper motor with two independent buttons. I'm new to Arduino and have only completed the most basic tutorials and was looking for some help. Below is the current code that we have compiled along with a photo of the stepper motor control the digital output the arduino supplies is wired to.

#include <Stepper.h>
#define STEPS 200
int btnS1 =10; // Pin for button S1;
int btnS2 =11; // Pin for button S2;
int enA = 4; // Enable pin 1 on Motor Control Shield;
int enB = 5; // Enable pin 2 on Motor Control Shield;
int dirA = 6; // Direction pin dirA on Motor Control Shield;
int dirB = 7; // Direction pin dirB on Motor Control Shield;
Stepper stepper(STEPS, 4,5,6,7);
const int stepsPerRevolution = 200; // Change this to fit the number of steps per revolution
// for your motor

// Initialize the stepper library on pins 12 and 13:
Stepper myStepper(stepsPerRevolution, dirA, dirB);

int val1 = digitalWrite(enA, HIGH);
int val2 = digitalWrite(enB, HIGH);

void setup() {
// Set the speed at 60 RPM:
stepper.setSpeed(60);

// Enable power to the motor

pinMode(enA, OUTPUT);
digitalWrite (enA, HIGH);

pinMode(enB, OUTPUT);
digitalWrite (enB, HIGH);

pinMode(btnS1, OUTPUT);
pinMode(btnS2, OUTPUT);
}

void loop() {
// put your main code here, to run repeatedly:

if (digitalRead(btnS1)==HIGH){stepper.step(val1);}

if(digitalRead (btnS2)==HIGH){stepper.step(val2);}

Here is the link to the motor control we are wiring into.

Thanks to whomever has a chance to look this over! This is for and engineering capstone and we are at a dead end.

Hello I was wondering how to properly write a code to control the up down functions of a stepper motor with two independent buttons.

Have you actually looked at your stepper motor? Do you see any UP motion? Do you see any DOWN motion. Steppers step, clockwise or counterclockwise.

Here is the link to the motor control we are wiring into.

Perhaps you could post a picture, too.

This is for and engineering capstone and we are at a dead end.

One would think that by the time one was a senior in college, one could say what they needed help with.

int val1 = digitalWrite(enA, HIGH);
int val2 = digitalWrite(enB, HIGH);

What, exactly, does digitalWrite() return? How is that value useful?

How are your switches wired?

Have a look at this simple stepper code. It should work with those stepper drivers. Also look at stepper motor basics.

...R