Arduino Uno Code for Stepper motor

I am a "TRUE NEWBIE" at this. What I would like is someone to assist me in creating a simple code set. I have an Arduino Uno, a 5v volt-5 wire-4 pin Stepper motor, 28BYJ-48 with an X113647 driver interface.

I need a simple code that would allow an input on one pin, of a high or low (whichever works) that would initiate the code sequence. I need the code to pause for 3 seconds once the input is applied, then turn the stepper 90 degrees in 1.5 seconds, wait 20 seconds and then return to the original position, stop and wait for the next input.

This should be simple but I do not know code and to be honest as I read it, it confuses me. My apologies if I am just not smart enough to be on this forum but your positive assistance would be greatly appreciated.

Thank you,

Stephen

I can't find the specs for the X113647 stepper driver that you are using. Can you provide a link to them?

...R

stepper examples in the arduino IDE are very good, but a little bit complex.

Check out the Big Easy Driver:

From this you can go from the Arduino to the BED to the motor - code samples are on the site as well.

=Alan R.

Robin 2

I hope this will help you assist me.

http://www.geeetech.com/wiki/index.php/Stepper_Motor_5V_4-Phase_5-Wire_%26_ULN2003_Driver_Board_for_Arduino

I presume you are able to make the motor work using the code in the link you posted. And I presume you know how to make the motor move enough steps to give 90 degrees in 1.5 seconds

From your original post I think you need something like this pseudo code

boolean buttonPushed = false;
boolean motorCWDone = false;
unsigned long buttonPressedMillis;
unsigned long motorCWDoneMillis;
unsigned int motorCWDelay = 3000; // millisecs
unsigned int motorCCWDelay = 20000;

void setup() {
  // all the initial stuff
}

void loop() {
    checkButton();
    moveMotorCW();
}

void checkButton() {
   if (digitalRead(buttonPin) == HIGH) {
       buttonPushed = true;
       buttonMillis = millis();
   }
}

void moveMotorCW() {
  if (buttonPushed && millis() - buttonPressedMillis >= buttonDelay) {
     // code to move motor clockwise 90 degrees
     motorCWDone = true;
     motorCWDoneMillis = millis();
  }

void moveMotorCCW() {
  if (motorCWDone && millis() - motorCwDoneMillis >=motorCCWDelay) {
     // code to move motor counter clockwise 90 degrees
     buttonPushed = false; // ready for next button push
     motorCWDone = false;
  }
}

...R