Go Down

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

cachehiker

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


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