void loop()
{
for (int j=100; j>=0; j--) // slowly decrease mark-space ratio, increasing speed
{
Serial.print("Mark-space ratio is 4 - ");
Serial.println(j);
RotateMotor(1,0,1,j); // rotate motor Right @ set speed..
}//for()
for (int j=0; j<=100; j++) // slowly increase mark-space ratio, decreasing speed
{
Serial.print("Mark-space ratio is 4 - ");
Serial.println(j);
RotateMotor(1,0,1,j); // rotate motor Right @ set speed..
}//for()
}//end loop()
i've got an improved version of the variable-speed software which uses a 'kick-start' routine & a 'run' routine.
ReplyDeleteThe 'kick-start' is in the setup() part & the 'run' is in the loop().
i'll post it later..
i've found something else:
ReplyDeleteyou can use an Analog pin with a built-in PWM function (~470Hz)
i've been using PWM on the ENable pin on the DC-MINI board, but the 'truth-table' lists the EN as STOP when @ logic '0'.
maybe this is why the slower motion is so jerky?