I have been testing with machine.deepsleep(3000) and it works. I see with a crude measuring device that during the 3 seconds it's at 10mA. I wanted to see what machine.lightsleep(3000) did with RAM staying up, and see if ble connected any faster after it was over (since it doesn't have to start from reset every time) and for some odd reason the machine.lightsleep(3000) never wakes up again.
I looked at the ways to setup the wake trigger to ext0, ext1, and touch. But I didn't see one to explicitly call out RTC. So do I have to do that explicitly? I didn't for deepsleep().
Here is my code snippet:
Code: Select all
def demo():
time.sleep_ms(200)
ledpin = machine.Pin(2, machine.Pin.OUT)
ble = bluetooth.BLE()
temp = BLETemperature(ble)
network.WLAN(0).active(0)
network.WLAN(1).active(0)
t = 25
i = 0
total = 0
while True:
ledpin.on()
while total <20:
# Write every second, notify every N seconds.
total = total + 1
i = (i + 1) % 1
temp.set_temperature(t, notify=i == 0)
# Random walk the temperature.
t += random.uniform(-0.5, 0.5)
time.sleep_ms(800)
ledpin.off()
machine.lightsleep(3000)