Replies: 3 comments 1 reply
-
Should be as simple as setting up a pin interrupt on change or low level (rising and falling work too but only on pins 2 and 6 with in each port), going to sleep, and then waking ip by pressing to the button, and then putting the part to sleep. Pretty see the PinInterrupts and PowerSave documents in /megaavr/extras in the repo should give you want you need to know. If you've been trying with attachInterrupt, that's part of the problem - I've fixed the bug but none of the people who have test cases that reproduce the bug have gotten back to me about whether I fixed it. Currently it only works if the Old Version option is selected from tools -> attachInterruptMode The next release (2.5.11) will fix that, and it's in github, just not a release. I don't trust myself to test it since, well, this is version 2.5.11, and 9 of the past 10 releases have been "CRITICAL BUGFIX" to correct attachInterrupt. So clearly I don't have a good test case.... Though, I wouldn't use attachInterrupt for a wake interrupt unless I had a gun to my head - This should be straightforward:
See also: https://github.com/SpenceKonde/megaTinyCore/blob/master/megaavr/extras/PinInterrupts.md https://github.com/SpenceKonde/megaTinyCore/blob/master/megaavr/extras/PowerSave.md and https://github.com/SpenceKonde/megaTinyCore/blob/master/megaavr/extras/Ref_Interrupts.md |
Beta Was this translation helpful? Give feedback.
-
Your code works very well, thanks again. I just need to replace some typos and add a brace in the loop. Here is the working code.
|
Beta Was this translation helpful? Give feedback.
-
Great, glad to help - like I said, I was writing that off the top of my head in the forum, so if I only made a few syntax errors, that's pretty good for me. |
Beta Was this translation helpful? Give feedback.
-
Hi,
does anyone has an example to set the Tiny3227 into power down mode and wake up by a button?
In my project I use the Pins PA2, PA3 and PA4 (19,20,0).
Uwe
Beta Was this translation helpful? Give feedback.
All reactions