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

Multiple Timers Hanging #77

Open
RRDajay opened this issue Nov 26, 2020 · 4 comments
Open

Multiple Timers Hanging #77

RRDajay opened this issue Nov 26, 2020 · 4 comments

Comments

@RRDajay
Copy link

RRDajay commented Nov 26, 2020

Hi, I've modified the example code from the multiple timer folder with my desired interrupt time (1000 microseconds for Timer0 and 5000 microseconds for Timer3). From the arduino serial monitor, It seems that the arduino hangs at 5000us. Does this mean that the arduino does not know what ISR to prioritize? I've attached the code and the output of the arduino serial monitor for visualization.

void firstHandler(){
	Serial.println("[-  ] First Handler!");
}

void secondHandler(){
	Serial.println("[ - ] Second Handler!");
}

void thirdHandler(){
	Serial.println("[  -] Third Handler!");
}

void setup(){
	Serial.begin(115200);

	Timer0.attachInterrupt(firstHandler).start(1000);
	Timer3.attachInterrupt(secondHandler).start(5000);

}

void loop() {

}

image

Am I missing something? Its my first time using the library. Any help would be greatly appreciated. Thank you.

@kapyaar
Copy link

kapyaar commented Mar 17, 2021

Can you try detachInterrupt and reenable interrupt in the ISR, and see if that keeps it going?

@Eagle735
Copy link

I have the same Problem. DetachInterrupt and reenable it doesnt work.

@iddq
Copy link

iddq commented Dec 19, 2022

Don't use print in ISR. You could increase counters in ISRs and print their values in the loop. Please close this issue as it is invalid.

@TheOnlyBeardedBeast
Copy link

I have the same issue, I can not run 2 timers at the same time. At my program I start a timer, which runs periodically, the second timer is not running periodically, I change its frequency, and start it again. Somehow my second timer works all the time, but the first timer doe not, I made sure they are using different hardware timers;

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

5 participants