Hello , is possible to control DC motors with Sabertooth 2X12 connected to PWM pins ( rspi 3 B => GPIO16 , GPIO 19) ?
GPIO16 will be connected to S1
GPIO 19 will be connected to S2
Sabertooth DIP Settings 1 OFF 2 ON 3 ON 4 OFF 5 ON 6 OFF
Am I right ? Coding structure given below, I don’t know how to control, what’s wrong with my program ?
[code]
#define Motr1 4 // GPIO 16
#define Motr2 12 // GPIO 19
pinMode(Motr1, OUTPUT);
pinMode(Motr2, OUTPUT);
softPwmCreate(Motr1,0,100); // PWM Initialization
softPwmCreate(Motr2,0,100);
void RobotMotion::Forward_Manual_Motion() on
{
softPwmWrite(Motr2, 13);
softPwmWrite(Motr1, 13);
}
void RobotMotion::Stop_motion()
{
qDebug()<< “Robot stop” ;
softPwmWrite(Motr1,14);
softPwmWrite(Motr2,14);
delay(1000);
}
void RobotMotion::Backward_motion()
{
softPwmWrite(Motr1, 16);
softPwmWrite(Motr2, 16);
}[/code]
How to control direction ? I have tried with this programming but motor not stopping properly. Kindly help me to solve the problem.
Thanks