-
Notifications
You must be signed in to change notification settings - Fork 93
Open
Description
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.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels