Arduino Code:

==============================================================

#include <Stepper.h>


// Define the pins used by the stepper motor

#define IN1 8

#define IN2 9

#define IN3 10

#define IN4 11


// Define the steps per revolution of the stepper motor

const int stepsPerRevolution = 2048;


// Initialize the stepper motor object

Stepper myStepper(stepsPerRevolution, IN1, IN2, IN3, IN4);


void setup() {

  // Set the speed of the stepper motor in steps per second

  myStepper.setSpeed(10);

}


void loop() {

  // Rotate the stepper motor one full revolution clockwise

  myStepper.step(stepsPerRevolution);

  delay(1000);


  // Rotate the stepper motor one full revolution counterclockwise

  myStepper.step(-stepsPerRevolution);

  delay(1000);

}



No comments

   Arduino Code: ============================================================== #include <Stepper.h> // Define the pins used by the st...

Powered by Blogger.