我是这样改的
StepMotor( StepNumber%4+1 );
while( micros() - LastStepTime < StepDelay );
LastStepTime = micros();
}
////StepMotor(0); //停止输出脉冲,降低电能消耗,自动找北时无力注释掉
}
//----------------------------------------------------------------------------------------
void Stepper::StepMotor(int thisStep) {
switch( thisStep ) {
case 0: //停止输出脉冲 这里全LOW或HIGH,试试看那种电流小
digitalWrite(Pin1, LOW);
digitalWrite(Pin2, LOW);
digitalWrite(Pin3, LOW);
digitalWrite(Pin4, LOW);
break;
|