Skip to content

Timer will not delay for long periods #50

@antic-ml

Description

@antic-ml

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.");
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions