Example using Low Power Library

Does anyone have a simple, working example using AruduinoLowPower.h to put the chip to sleep, then wake it with a button?

All of the examples on this page in the docs lead to 404 errors:
https://www.arduino.cc/en/Reference/ArduinoLowPower

I am able to activate sleep() and deepSleep() using microseconds. The device comes back from sleep on its own.

But I can't figure out how to wake the device using a button press.

If you know how to make this work could you post your example?

After installing the library named “Arduino Low Power” via Library Manager (Sketch > Include Library > Manage Libraries in the Arduino IDE), you will find example sketches under the File > Examples > Arduino Low Power menu.

As for those 404 pages, I also wasn’t able to find them even on the Wayback Machine. It looks like maybe they never existed. But the tutorials really aren’t a lot more than what you find in the example sketches. If you like, you can report those bad links via the support form:
https://www.arduino.cc/en/contact-us
That will bring the issue to the attention of the people who can fix it.

I recently played with something very similar on an Arduino UNO clone, but using the Low Power library from LowPowerLabs. I don't think the library used matters as you've already got your device to sleep and wake after the sleep period expires.

My code below wakes an Arduino UNO when a button (connected to pin 2) is pressed:

#include "LowPower.h"

const byte BUTTON_PIN = 2;
volatile byte buttonPressed = 0;

void setup()
{
  Serial.begin(9600);
  Serial.println(F("Low Power Sleep Demo"));
  Serial.println(F("Using WDT to wake every 8 seconds"));
  Serial.flush();

  pinMode(BUTTON_PIN, INPUT_PULLUP);
  attachInterrupt(digitalPinToInterrupt(BUTTON_PIN), isrButton, FALLING);
  delay(1000);
}

void loop()
{
  Serial.println(".");
  Serial.flush();

  LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF);

  if (buttonPressed == 1) {
    Serial.println("+");
    Serial.flush();
    buttonPressed = 0;
  }
}

// ISR called when button is pressed. Just set a flag.
void isrButton()
{
  buttonPressed = 1;
}

You should be able to modify your code to define the pin that the button is attached to and set it up as an input and then use attachInterrupt() to tell the board what code to execute when the button is pressed. Don't forget to define the flag in the ISR as volatile.

@pert thank you so much! I'm returning to Arduino development after a few years hiatus, and I completely forgot all the tutorials were baked into the IDE. I just had to scroll down to the bottom to find it. I've got the sketch working with my Seeeduino Xiao. I'm going to find out how long I can power this thing on a single AA battery with deepSleep() enabled.

You're welcome. I'm glad if I was able to be of assistance. Enjoy!
Per