Closed leozulfiu closed 6 years ago
I added another println statement (Serial.println("In setup method");
) in the setup method to debug the issue and found out that the microcontroller is restarting itself after each sleep cycle.
Is this a bug or an issue with my sketch?
I have tested your program with IDE 1.8.5 + AVR Boards 1.6.206 and it is working. I have only activated the pull-up on pin 2.
void setup() {
pinMode(wakePin, INPUT);
digitalWrite(wakePin, HIGH);
The Problem
I would like to put the atmega328pb to sleep and wake up again when pressing a button which is connected to an external interrupt pin. I tried it with the attached sketch but it doesn't work really stable.
Observations
count
is increased with each button push. IMO pressing the button shouldn't affect the loop execution at all.Example Code