Go Down

Topic: Delay() works, but millis() doesn't? (Read 2761 times) previous topic - next topic


Code: [Select]
  //Test for recording State
      long endTime;
      while (millis() < endTime && millis() > startTime){
      lcd.print("Recording! ");
      recState = true;
    //test for interval passed
      while (recState == true)
      if((millis() - startTime) > interval){

in effect this is if while (millis() < endTime && yada yada all ok until millis rolls over)

since endTime = startTime + interval then if (millis() - startTime > interval) is the same as if (millis() > endTime)

so, what do you suppose it does when millis() = endTime?

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131