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

  //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?

Pages: 1 [2]   Go Up
Jump to: