Pages: 1 [2]   Go Down
Author Topic: Delay() works, but millis() doesn't?  (Read 1844 times)
0 Members and 1 Guest are viewing this topic.
The Udaho Border
Offline Offline
Newbie
*
Karma: 2
Posts: 18
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
  //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?
Logged

Pages: 1 [2]   Go Up
Jump to: