PICO lightsleep and pin hold #12648
-
One benefit of lightsleep, on the ESP32, is that one can hold the pin state during lightsleep. This capability does not appear to be possible on the RP2040 devices. Have I missed something? |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 10 replies
-
What makes you think it doesn't? from machine import Pin, lightsleep
l = [x for x in range(50,200+1,10)]
idx = 0
pin = Pin(25,Pin.OUT)
while True:
pin.toggle()
lightsleep(l[idx])
pin.toggle()
lightsleep(l[idx])
idx = (idx+1) % len(l) |
Beta Was this translation helpful? Give feedback.
-
I have since found a comment And thank you for the code snippet. |
Beta Was this translation helpful? Give feedback.
-
I tried the code snippet and now I can't reclaim my PICO. Holding the boot selector while plugging it in says the .uf2 file is no longer there, but the program still runs and I can't stop it. |
Beta Was this translation helpful? Give feedback.
-
@peterhinch, tried your suggestion as follows: from time import sleep
from machine import Pin
from sys import exit
breakout = Pin(16, Pin.IN, Pin.PULL_UP)
if not breakout(): # Pull down for REPL
exit()
led = Pin('LED', Pin.OUT)
led.off()
while True:
led.off()
sleep(0.5)
led.on()
sleep(0.5) It works, but I have noticed an unexpected behaviour. I will start another thread. |
Beta Was this translation helpful? Give feedback.
What makes you think it doesn't?