Product | Breakout | Official Motor Drive Shield-L293D
Official Motor Drive Shield-L293D
Official Motor Drive Shield-L293D
41802
More than 100
 
US$12.98 Loading ...
 
Share/Save/Bookmark


                      Arduino Official Motor Drive Shield-L293D


This motor drive shield of Arduino based on L293D chip, it can drive two DC electric machine.


you can drive DC electric machine easily by this shield, you only need to insert the shield to Arduino, link the DC electric machine to motors's pin of the shield.


As mention above, you should get external power of Arduino,and use transformer and power work for Arduino.Here we choose 9V transformer and 9V DC electric machine.


motors pin above on motor shield to motor 1,motors pin below on motor shield to motor 2


When finish linking ,the next step is how to control by program.We can control direction of rotation and speed of rotation of DC electric machine.To control direction of rotation are digital I/O pin 12 and 13 of Arduino;to control speed of rotation are digital I/O pin 9 and 10 of Arduino
if you want to control DC electric machine 1, you need to do this:export PWM signal to pin 9 to control speed of electric machine , and set pin 12 and 13 voltage as high or low to control derection of electric machine;
if you want to control DC electric machine 2, you need to do this:export PWM signal to pin 10 to control speed of electric machine , and set pin 12 and 13 voltage as high or low to control derection of electric machine;
electric motor shield contain two button :S1 to pin7 of Arduino digital I/O and S2 to pin6 of Arduino digital I/O,low when press.So we can control S1 by program as below.

int switchPin = 7;  // switch pin
int dir1Pin = 12;   // direction 1
int dir2Pin = 13;   // direction 2
int speedPin = 9;   // spped pin

void setup() {
  pinMode(switchPin, INPUT);
  pinMode(dir1Pin, OUTPUT);
  pinMode(dir2Pin, OUTPUT);
  pinMode(speedPin, OUTPUT);
}

void loop() {
  // switch is pressed
  if (digitalRead(switchPin) == LOW) {
    // set spped
    analogWrite(speedPin, 250);
    // set direction
    digitalWrite(dir1Pin, LOW);
    digitalWrite(dir2Pin, HIGH);
  } else {
    analogWrite(speedPin, 100);
    digitalWrite(dir1Pin, HIGH);
    digitalWrite(dir2Pin, LOW);
  }
}


download to Arduino and run,we can use S1 to change direction and speed of electric  motor.







Write a review
*Review title
Please enter subject.
*Your review
Please enter review.
*Rating
(Click star icon to comment)
 
Display name
*Enter security code

CAPTCHA

Please enter code
Loading ...