I have found some information about using millis() for time limiting application on the forum, so I tried to use it. but it doesn't work, giving me this error:
error: stray '' in program In function 'void RotatorLeft()':
here my small portion code that I use to do it:
void RotatorLeft() // LEFT = HIGH
{
unsigned long StartTime = millis();
while (RotatorLevel <= (RequestDegree) -3 && StopRotation !=1 && millis() – StartTime < 90000 && RotatorLevel < 360) { digitalWrite(LEFT_OUT, HIGH); digitalWrite(POWER_OUT, HIGH); ReadRotator(); SerialRotatorSend();}
digitalWrite(POWER_OUT, LOW);
digitalWrite(LEFT_OUT, LOW); RequestDegree=0;
StopRotation = 1;
}
So my goal is that the script stop working after 90 sec, so not to blow the motor, as it should never take so long and probably something wrong happening.