DC Motor Driver 2x15A Lite with Raspberry Pi
![userHead](https://dfimg.dfrobot.com/dfPortrait2.png)
I purchased the DC Motor Driver 2x15A Lite with the intent of controlling it with a Raspberry Pi. Having some difficulty following the example in the Wiki page regarding PWM control. If I want both motors to go forward, I set the M1 & M2 pins to a digital High, and the E1 & E2 to the PWM speed I want the motors run at correct? If want the motors to run at the same speed in reverse set both M1 & M2 to low? I've tried that and the motors do not reverse direction. When I set the M1 & M2 pins digital low the motors stop turning.
What am I missing? Any help would be greatly appreciated.
Thanks
Brian
What am I missing? Any help would be greatly appreciated.
Thanks
Brian
2017-08-11 20:52:13 you should try motor driver IC L293D to drive two DC motors. It is very easy to run DC motors with Raspberry pi like see the below code:
HEre is the dfrobot demo of two DC motors rolling with Raspberry pi and L293D: Raspberry Pi surveillance robot.
jaysharma5
Code: Select all
Here you can assign m11, m12... to any GPIO pin of RPI where you have connected DC motors. GPIO.output(m11 , 0)
GPIO.output(m12 , 1)
GPIO.output(m21 , 0)
GPIO.output(m22 , 1)
HEre is the dfrobot demo of two DC motors rolling with Raspberry pi and L293D: Raspberry Pi surveillance robot.
![userHeadPic](https://dfimg.dfrobot.com/dfPortrait2.png)
2017-03-08 18:32:13 Hi Brian,
Yes, if you want both motors to go forward, you can refer to this code:
void advance(char a,char b) //Move forward
{
analogWrite (E1,255); //PWM Speed Control
digitalWrite(M1,HIGH);
analogWrite (E2,255);
digitalWrite(M2,HIGH);
The above code the motor will move forward at same speed(0-255), 0 is stop, 255 is max speed. If set to low, both motors will move backward.
Wendy.Hu
Yes, if you want both motors to go forward, you can refer to this code:
void advance(char a,char b) //Move forward
{
analogWrite (E1,255); //PWM Speed Control
digitalWrite(M1,HIGH);
analogWrite (E2,255);
digitalWrite(M2,HIGH);
The above code the motor will move forward at same speed(0-255), 0 is stop, 255 is max speed. If set to low, both motors will move backward.
![userHeadPic](https://dfimg.dfrobot.com/dfPortrait2.png)