Deep sleep Beetle RP2350 Arduino
lahcen.hammeni 2026-03-25 21:38:46 93 Views1 Replies How can i put a Beetle RP2350 in sleep mode using Arduino code
try this code:
#include "pico/sleep.h"
#include "pico/runtime.h"
#include "hardware/rtc.h"
const int WAKE_PIN = 10; // The GPIO used to wake the device
void setup() {
Serial.begin(115200);
pinMode(WAKE_PIN, INPUT_PULLUP);
pinMode(LED_BUILTIN, OUTPUT);
}
void loop() {
digitalWrite(LED_BUILTIN, HIGH);
delay(2000);
digitalWrite(LED_BUILTIN, LOW);
Serial.println("Entering Sleep Mode... Pull GPIO 10 to Ground to wake.");
Serial.flush(); // Ensure serial buffer is empty before sleeping
// Function to handle the sleep logic
sleep_goto_dormant_until_pin_low(WAKE_PIN);
// Execution resumes here after waking up
Serial.println("Woken up!");
}
void sleep_goto_dormant_until_pin_low(uint gpio) {
// Configure the GPIO to wake the processor
// This is a simplified representation of the SDK call
sleep_run_from_xosc(); // Switch to the crystal oscillator
sleep_goto_dormant_until_edge_high(gpio);
}
R2D2C3PO 
