Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Timer will not delay for long periods #50

Open
antic-ml opened this issue Jun 16, 2021 · 0 comments
Open

Timer will not delay for long periods #50

antic-ml opened this issue Jun 16, 2021 · 0 comments

Comments

@antic-ml
Copy link

antic-ml commented Jun 16, 2021

I tried to use TimerOne to delay for a period of 5 seconds and it did not work. Code below:

#include <TimerOne.h>
bool wait;

void setup() {
  wait = 1;
  Timer1.initialize(0);
  Serial.begin(9600);
  while( ! Serial )
    ;
}

void timerExpired() {
  wait = 0;
}
void loop() {
  Timer1.attachInterrupt(timerExpired, 1000000 * 5);
  Timer1.start();
  Serial.println("Waiting...");
  while( wait )
    ;
  Timer1.detachInterrupt();
  wait = 0;
  Serial.println("Timer expired.");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant