Quantity | 3+ units | 10+ units | 30+ units | 50+ units | More |
---|---|---|---|---|---|
Price /Unit | $12.16 | $11.91 | $11.54 | $11.04 | Contact US |
Arduino DC Motor Driving Develop Board Expansion Board L298P Driving Module H Bridege for Smart Car
Description:
- L298P shield DC motor driver adopts L298P, can directly drive two DC motor, driving motor reaches 2A, motor output terminal adopts 8 high speed diode for protection
Parameters:
- Motor driviing voltage: external intput: 3-35V, internal input: 6-12V
- Logic terminal current: <30mA
- Driving current: 2A
- Drving peak current: 4A
- Max power: 25W
- Working temp: -25---130degree
- Can directly plug in ArduinoUNO、leonardo、mega2560 board, with no current detection, the programme has four pins:
- PWMA: D4(~)pin
- DIRA: D5 pin
- PWMB: D6(~)pin
- DIRB: D7 pin
Arduino reference code:
int E1 = 4; //PWMA
int M1 = 5; //DIRA
int E2 = 6; //PWMB
int M2 = 7; //DIRB
int Val = 0;
int ChangeValue = 20; //the speed value ,changevalue from 0-255
void setup()
{
pinMode(M1, OUTPUT);
pinMode(M2, OUTPUT);
}
void foward()
{
digitalWrite(M1,LOW);
analogWrite(E1, Val); //the speed value of motorA is 20
digitalWrite(M2,LOW);
analogWrite(E2, Val); //the speed value of motorB is 20
Val = Val + ChangeValue;
if (Val == 0 || Val == 255)
{
ChangeValue = -ChangeValue;
}
delay(100);
}
void back()
{
digitalWrite(M1,HIGH);
analogWrite(E1, Val); //PWM调速
digitalWrite(M2,HIGH);
analogWrite(E2, Val); //PWM调速
Val = Val + ChangeValue;
if (Val == 0 || Val == 255)
{
ChangeValue = -ChangeValue;
}
delay(100);
}
void loop()
{
foward();
delay(500);
back();
delay(500);
}