user37658: I'm looking for a way to swap servo 1 with a stepper motor to achieve a single direction circular motion with stops and delay. Instead, now I have the servo going back and forth to repeat the action.

This is the code I'm currently using to drive the servo:
void loop() {
  topServo.write(115);
  delay(500);

  for(int i = 115; i > 65; i--) {
    topServo.write(i);
    delay(2);
}


This is a schematic of my project:

simulate this circuit – Schematic created using CircuitLab
Can anyone help me to configure this? or point me into the right direction.
Any help would be greatly appreciated!

user33608: Firstly, I'm going to assume that you got a ULN2003 Motor driver board something like this along with your 28-BYJ48 stepper motor.
Secondly, I would always recommend using a separate power supply for your stepper motors. Even a small stepper motor like the 28-BYJ48 can draw up to 320mA, (160mA per winding).

I've used the following code to test a setup using a 28-BYJ48 stepper motor and an Arduino. The connections to the driver board (IN1 - IN4) are mapped to pins 8-11 on the Arduino in this case. The code will cause the stepper to rotate 1 full revolution in one direction, pause for 1 second and then rotate one full revolution in the other direction.
(I've often found this simple piece of code really handy for troubleshooting!)
#include <Stepper.h>

const int stepsPerRev = 2048

// initialise the stepper library on pins 8, 9, 10 & 11
Stepper myStepper(stepsPerRev, 8,10,9,11);        

void setup() {
  // set the speed
  myStepper.setSpeed(4);

}

void loop() {
  // step one revolution in one direction:
  myStepper.step(stepsPerRev);
  delay(1000);

  // step one revolution in the other direction:
  myStepper.step(-stepsPerRev);
  delay(1000); 

}


37658: <p>I'm looking for a way to swap servo 1 with a stepper motor to achieve a single direction circular motion with stops and delay. Instead, now I have the servo going back and forth to repeat the action.</p>

<p><a href="https://i.stack.imgur.com/8mOmz.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/8mOmz.png" alt="enter image description here"></a></p>

<p>This is the code I'm currently using to drive the servo:</p>

<pre><code>void loop() {
  topServo.write(115);
  delay(500);

  for(int i = 115; i &gt; 65; i--) {
    topServo.write(i);
    delay(2);
}
</code></pre>

<p><br>
This is a schematic of my project:</p>



<p><img src="https://i.stack.imgur.com/T9MCD.png" alt="schematic"></p>



<p><sup><a href="/plugins/schematics?image=http%3a%2f%2fi.stack.imgur.com%2fT9MCD.png">simulate this circuit</a> &ndash; Schematic created using <a href="https://www.circuitlab.com/" rel="nofollow">CircuitLab</a></sup></p>

<p>Can anyone help me to configure this? or point me into the right direction.
<br>Any help would be greatly appreciated!</p>
 33608: <p>Firstly, I'm going to assume that you got a ULN2003 Motor driver board something like <a href="http://42bots.com/wp-content/uploads/2014/02/stepper01.jpg" rel="nofollow noreferrer">this</a> along with your 28-BYJ48 stepper motor.</p>

<p>Secondly, I would always recommend using a separate power supply for your stepper motors. Even a small stepper motor like the 28-BYJ48 can draw up to 320mA, (160mA per winding).</p>

<hr>

<p>I've used the following code to test a setup using a 28-BYJ48 stepper motor and an Arduino. The connections to the driver board (IN1 - IN4) are mapped to pins 8-11 on the Arduino in this case. The code will cause the stepper to rotate 1 full revolution in one direction, pause for 1 second and then rotate one full revolution in the other direction.</p>

<p>(I've often found this simple piece of code really handy for troubleshooting!)</p>

<pre><code>#include &lt;Stepper.h&gt;

const int stepsPerRev = 2048

// initialise the stepper library on pins 8, 9, 10 &amp; 11
Stepper myStepper(stepsPerRev, 8,10,9,11);        

void setup() {
  // set the speed
  myStepper.setSpeed(4);

}

void loop() {
  // step one revolution in one direction:
  myStepper.step(stepsPerRev);
  delay(1000);

  // step one revolution in the other direction:
  myStepper.step(-stepsPerRev);
  delay(1000); 

}
</code></pre>
