#include #include #include "nrf.h" #include const int red = 6; const int green = 9; void setup() { Serial.begin(9600); pinMode(red, OUTPUT); pinMode(green, OUTPUT); // put your setup code here, to run once: // If desired, change the RAM retention parameters: NRF_POWER->RAMON = POWER_RAMON_ONRAM0_RAM0On << POWER_RAMON_ONRAM0_Pos | POWER_RAMON_ONRAM1_RAM1On << POWER_RAMON_ONRAM1_Pos | POWER_RAMON_OFFRAM0_RAM0Off << POWER_RAMON_OFFRAM0_Pos | POWER_RAMON_OFFRAM1_RAM1Off << POWER_RAMON_OFFRAM1_Pos; digitalWrite(red, LOW); digitalWrite(green, LOW); delay(2000); } void loop() { Serial.println("Awake 1"); delay(500); __SEV(); __WFE(); //************************* //Without using softdevice //************************* //1. //__WFE(); //2. //__WFI(); //***************** //Using softdevice //***************** //1. sd_app_evt_wait(); // Enter system OFF. After wakeup the chip will be reset, and the MCU will run from the top //NRF_POWER->SYSTEMOFF = 1; //NRF_POWER->TASKS_LOWPWR = 1; delay(500); Serial.println("Awake 2"); digitalWrite(green, HIGH); delay(500); digitalWrite(green, LOW); }