void setZSX11HV1(int pinDir, int pinPWM, int pinBrake, int speed, boolean brake) {
//setZSX11HV1(pinMotorRightDir, pinMotorRightPWM, pinMotorRightEnable, value, useMotorDriveBrake);
if (speed < 0) {
digitalWrite(pinBrake, LOW) ;
digitalWrite(pinDir, LOW) ;
analogWrite(pinPWM, ((byte)abs(speed)));
}
if (speed > 0) {
digitalWrite(pinBrake, LOW) ;
digitalWrite(pinDir, HIGH) ;
analogWrite(pinPWM, ((byte)abs(speed)));
}
if (speed == 0) {
analogWrite(pinPWM, 0);
digitalWrite(pinDir, HIGH) ;
if (brake) {
digitalWrite(pinBrake, HIGH) ; // active the brake function of the motor driver
}
}
}