Skip to content

I am using a Cytron MD-13S motor driver board #2

Description

@cosmicone

How do I modify the sketch? The cytron has a PWM pin and a direction pin. I am also using a cytron library.

I changed the clockwise and counterclockwise functions as follows:

void MotorClockwise(int power){
if(power > 100){
// analogWrite(7, power);
// digitalWrite(4, LOW);
motor.setSpeed(128); // Run forward at 50% speed.
}else{motor.setSpeed(0); // Stop
// digitalWrite(4, LOW);
// digitalWrite(7, LOW);

}
}

void MotorCounterClockwise(int power){
if(power > 100){
// analogWrite(7, power);
// digitalWrite(4, HIGH);
motor.setSpeed(-128); // Run backward at 50% speed.
}else{
// digitalWrite(4, LOW);
// digitalWrite(7, LOW);
motor.setSpeed(0); // Stop
}
}

It doesn't work -- the motor keeps going and going.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions