Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
cosmicone opened this issue Nov 13, 2020 · 0 comments
Open

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

cosmicone opened this issue Nov 13, 2020 · 0 comments

Comments

@cosmicone
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant