Is time.sleep() (or utime.sleep()) the same thing as machine.lightsleep()? They take slightly different arguments (float seconds vs. int milliseconds), but functionally are they doing the same thing? Is there a recommendation between the two? Are the functions under the machine module meant to supplant the sleep() function in the time module and we aren't intended to use time.sleep()?
What about time.sleep_ms() (which is conceptually even more similar to machine.lightsleep()) and time.sleep_us()?
Relatedly, ESP8266 is often described in terms of "modem sleep" in other environments (Arduino), a term that doesn't appear in the MicroPython docs excerpt as a constant in the esp module. How is modem sleep achieved in MicroPython? Is it simply tantamount to deactivating the network interfaces?
Thanks.
time.sleep() vs machine.lightsleep()
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Re: time.sleep() vs machine.lightsleep()
The sleep methods of the time module provide accurate delays but do not provide power saving.
Peter Hinch
Index to my micropython libraries.
Index to my micropython libraries.