Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 4788

MicroPython • Re: Trouble with lightsleep() and deepsleep() in MicroPython

$
0
0
For MicroPython on an RP2040 'deepsleep' is currently just a synonym for 'lightsleep'; behaviour will be the same and there is no additional current saving gained.

It doesn't work for me with this simple test program. The LED flashes five times to show it's working, then the LED is on for 5 seconds before sleeping, off for 5 seconds while sleeping, then it should repeat and start flashing again -

Code:

from   machine import Pin, deepsleepimport time#          _   _   _   _   _   _____________               _   _# Led : __| |_| |_| |_| |_| |_|             |_____________| |_| |_#         :                   :             :             :#         #<----- 5 sec ----->:<-- 5 sec -->:<-- 5 sec -->:led = Pin("LED", Pin.OUT)while True:  for n in range(5):    led.on()    time.sleep(0.5)    led.off()    time.sleep(0.5)  led.on()  time.sleep(5)  led.off()  deepsleep(5000)
For me, after the first time through the loop, the LED goes off and never turns on again

Statistics: Posted by hippy — Sat May 11, 2024 9:07 am



Viewing all articles
Browse latest Browse all 4788

Trending Articles