Introduction
The Motor Shield V1.0 is a platform for robotics and mechanical applications based on L298P. It can be used to drive double DC motor or a 4-wire stepper. When controlling double DC motor, there are Only 4 control pins were been used, which makes more easily to control, and saves the control pins for controller. The Drive current can be up to 2A per motor output for the add of the heat sink. Measure the driver current by the additional resistance, makes the system more smarter.
Technical Data
Operating voltage: 4.5V to .55V,
Typical operate voltage: 5V
Drive Voltage: 6v to 15V
Typical drive voltage: 12V
Output current: 2A
Features
The logic control voltage: 4.5~5.5V
Motor Supply Voltage: 6~ 15V
Reduced control pins needed
Measurement for driver current
Drive part of the operating current Io: 2A
Maximum power dissipation: 25W (T = 75 degree Celsius)
Operating temperature: -25 degree Celsius ~ +130 degree Celsius
Drive Type: Dual high-power H-bridge driver
Interface
Usage
Let’s test it
Plug Motor shield to Arduino/Catduino
Burn our program to Arduino/Catduino
Connect motor to motor shield, motor will work
[code]
int MotorLeft1=8; // IN1
int MotorLeft2=11; // IN2
int MotorRight1=12; // IN3
int MotorRight2=13; // IN4
int MotorRPWM=9; //PWM EA
int MotorLPWM=10; //PWM EB
void setup()
{
Serial.begin(9600);
pinMode(MotorRight1, OUTPUT);
pinMode(MotorRight2, OUTPUT);
pinMode(MotorLeft1, OUTPUT);
pinMode(MotorLeft2, OUTPUT);
pinMode(MotorLPWM, OUTPUT);
pinMode(MotorRPWM, OUTPUT);
}
void loop()
{
LeftMotorRun();
delay(5000);
Stop();
delay(2);
RightMotorRun();
delay(5000);
Stop();
delay(2);
advance();
delay(5000);
Stop();
delay(2);
back();
delay(5000);
Stop();
delay(2);
}
void back() // go
{
digitalWrite(MotorRight1, HIGH);
digitalWrite(MotorRight2, LOW);
digitalWrite(MotorLeft1, HIGH);
digitalWrite(MotorLeft2,LOW);
analogWrite(MotorLPWM,200);
analogWrite(MotorRPWM,200);
}
void advance() // go forward
{
digitalWrite(MotorRight1, LOW);
digitalWrite(MotorRight2, HIGH);
digitalWrite(MotorLeft1, LOW);
digitalWrite(MotorLeft2,HIGH);
analogWrite(MotorLPWM,200);
analogWrite(MotorRPWM,200);
}
void LeftMotorRun() //test the left motor
{
digitalWrite(MotorRight1, LOW);
digitalWrite(MotorRight2, HIGH);
digitalWrite(MotorLeft1, LOW);
digitalWrite(MotorLeft2,HIGH);
analogWrite(MotorLPWM,0);
analogWrite(MotorRPWM,255);
}
void RightMotorRun() //test the right motor
{
digitalWrite(MotorRight1, LOW);
digitalWrite(MotorRight2, HIGH);
digitalWrite(MotorLeft1, LOW);
digitalWrite(MotorLeft2,HIGH);
analogWrite(MotorLPWM,255);
analogWrite(MotorRPWM,0);
}
void Stop() //stop
{
digitalWrite(MotorRight1, LOW);
digitalWrite(MotorRight2, LOW);
digitalWrite(MotorLeft1,LOW);
digitalWrite(MotorLeft2,LOW);
analogWrite(MotorLPWM,0);
analogWrite(MotorRPWM,0);
}
[/code]
Resource