Control motors with Pololu DRV8835 Dual Motor Driver
Posted: Sun Jun 28, 2015 10:23 am
Hi,
I'm trying to make 2 motors move using Pololu DRV8835 Dual Motor Driver and Java, but it seems that I'm not setting correctly the pins, and it does not lead to movement of the wheels.
When using Pololu driver, GPIO 12 and 5 are used to control the speed and direction, respectively, of motor 1, and GPIO 13 and 6 control the speed and direction of motor 2.
This is the program:
I'm referring to https://github.com/pololu/drv8835-motor ... 835_rpi.py written in Python and http://javatutorial.net/raspberry-pi-co ... otor-speed
Does anyone see what is wrong with the code above?
Thanks.
I'm trying to make 2 motors move using Pololu DRV8835 Dual Motor Driver and Java, but it seems that I'm not setting correctly the pins, and it does not lead to movement of the wheels.
When using Pololu driver, GPIO 12 and 5 are used to control the speed and direction, respectively, of motor 1, and GPIO 13 and 6 control the speed and direction of motor 2.
This is the program:
Code: Select all
public class MovingRobot {
public static void main(String[] args) {
System.out.println("Started");
Gpio.wiringPiSetup();
GpioController gpio = GpioFactory.getInstance();
GpioPinDigitalOutput output1 = gpio.provisionDigitalOutputPin(RaspiPin.GPIO_05);
GpioPinDigitalOutput output2 = gpio.provisionDigitalOutputPin(RaspiPin.GPIO_06);
SoftPwm.softPwmCreate(12, 0, 100);
SoftPwm.softPwmCreate(13, 0, 100);
SoftPwm.softPwmWrite(12, 25);
try {
Thread.sleep(3000);
} catch (InterruptedException e) {
e.printStackTrace();
}
SoftPwm.softPwmWrite(13, 25);
try {
Thread.sleep(3000);
} catch (InterruptedException e) {
e.printStackTrace();
}
SoftPwm.softPwmWrite(12, 50);
try {
Thread.sleep(3000);
} catch (InterruptedException e) {
e.printStackTrace();
}
SoftPwm.softPwmWrite(13, 50);
try {
Thread.sleep(3000);
} catch (InterruptedException e) {
e.printStackTrace();
}
SoftPwm.softPwmWrite(12, 100);
try {
Thread.sleep(3000);
} catch (InterruptedException e) {
e.printStackTrace();
}
SoftPwm.softPwmWrite(13, 100);
try {
Thread.sleep(3000);
} catch (InterruptedException e) {
e.printStackTrace();
}
SoftPwm.softPwmWrite(12, 0);
try {
Thread.sleep(3000);
} catch (InterruptedException e) {
e.printStackTrace();
}
SoftPwm.softPwmWrite(13, 0);
try {
Thread.sleep(3000);
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.println("Finished");
}
}
Does anyone see what is wrong with the code above?
Thanks.