|
楼主 |
发表于 2020-5-26 20:06:14
|
显示全部楼层
本帖最后由 双木觅林 于 2020-5-26 20:07 编辑
task main()
{
int speed = 0;
//Infinite loop
while(true)
{
//If the motor is less than its target (100)
if(getMotorRPM(motorA) < 50)
{
//Increase the value of speed
speed = speed + 1;
displayTextLine(2, "%d", speed);
displayTextLine(4, "%d", getMotorRPM(motorA));
//Brief sleep period (2 milliseconds)
sleep(1000);
}
//Then apply the value of speed to the motors
//This should cause the speed to 'ramp' up
setMotorSpeed(motorA, speed);
setMotorSpeed(motorB, speed);
}
}
得到的getMotorRPM(motorA)值达不到49,偏差3
|
|