Example wake-up on pin interrupt code (Version 1.0 XIAO BLE)

(some may be redundant, but just covering all bases :slight_smile:

#include <Arduino.h>

void setup() {
// put your setup code here, to run once:
uint32_t pin = A0;
pin = g_ADigitalPinMap[pin];
nrf_gpio_cfg_sense_input(pin, NRF_GPIO_PIN_PULLDOWN, NRF_GPIO_PIN_SENSE_HIGH);
delay(15000);//15 seconds before turns off (if USB is plugged in, that circuit will still draw 2mA)
sd_power_system_off();
NRF_POWER->SYSTEMOFF = 1;
}

void loop() {
// put your main code here, to run repeatedly:
sd_power_mode_set(NRF_POWER_MODE_LOWPWR);
sd_power_dcdc_mode_set(NRF_POWER_DCDC_ENABLE);
__WFE();
__WFI();
sd_app_evt_wait() ; //SOFT DEVICE “SYSTEM ON” POWER SAVE

delay(10);
}

1 Like