pat
Published © LGPL

DC Motor Control with L293D Shield

Unlock the power of Arduino with our DC Motor Control Project! Use the L293D Shield to seamlessly manage motor directions and speed. Perfect

BeginnerFull instructions provided70
DC Motor Control with L293D Shield

Things used in this project

Story

Read more

Schematics

Schematics

Code

Code

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

// Initialize motor
AF_DCMotor motor(4); // Motor connected to M4 on the motor driver shield

void setup() {
  motor.setSpeed(200); // Set initial speed
}

void loop() {
  // Move the motor forward (clockwise)
  motor.run(FORWARD);
  delay(2000); // Run for 2 seconds

  // Stop the motor
  motor.run(RELEASE);
  delay(1000); // Stop for 1 second

  // Move the motor backward (counter-clockwise)
  motor.run(BACKWARD);
  delay(2000); // Run for 2 seconds

  // Stop the motor
  motor.run(RELEASE);
  delay(1000); // Stop for 1 second
}

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.