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

Attaching two different interrupts #19

Closed
JMattChiam opened this issue Dec 1, 2020 · 3 comments
Closed

Attaching two different interrupts #19

JMattChiam opened this issue Dec 1, 2020 · 3 comments

Comments

@JMattChiam
Copy link

No description provided.

@JMattChiam
Copy link
Author

Hi, i'm trying to attach two different interrupts to wake up the arduino. One when a button is pressed, and another connected to an external timer. How would i go about doing this?
Thanks!

@nullboundary
Copy link
Collaborator

Hi, I don't know exactly as I have no way to currently test this, however I would think perhaps you could combine the examples Sleep_n0m1_Interrupt and Sleep_n0m1_abortsleep. You could use the external timer to set the abortsleep flag and set the interrupt pin to the button pressed. You need to make sure you set the sleep mode so that you don't sleep the timer you want to use as well. Try that and let me know how it goes!

@JMattChiam
Copy link
Author

Hi!
I realised that just attaching an additional interrupt with attachInterrupt() is sufficient for my purposes (just change a flag that runs a function in the main loop before going back to sleep). My main timer is still attached to sleepPinInterrupt.
Thanks for the help!

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

2 participants