Welcome to Hackster!
Hackster is a community dedicated to learning hardware, from beginner to pro. Join us, it's free!
pat
Published © LGPL

Nema Stepper Motor with L293D motor driver shield

Control a NEMA 17 stepper motor with an L293D shield via Arduino for precise, reliable movements in your projects.

BeginnerFull instructions provided193
Nema Stepper Motor with L293D motor driver shield

Things used in this project

Story

Read more

Schematics

Schematic

Code

Code

C/C++
#include <AFMotor.h>

// Create the motor object using the Adafruit Motor Shield library
AF_Stepper motor(200, 1);  // 200 steps per revolution, connected to motor port 2 (M3 and M4)

void setup() {
  Serial.begin(9600);  // Start serial communication
  motor.setSpeed(60);  // Set the speed to 60 RPM
}

void loop() {
  Serial.println("Clockwise");
  motor.step(200, FORWARD, SINGLE);  // Move 200 steps clockwise
  delay(500);
  
  Serial.println("Counterclockwise");
  motor.step(200, BACKWARD, SINGLE);  // Move 200 steps counterclockwise
  delay(500);
}

Credits

pat
13 projects • 4 followers
AI Convergence Engineering, Software Engineering, ML, deep learning, image processing, computer vision, circuit design, and Edge AI devices.
Contact

Comments

Please log in or sign up to comment.