This repository was archived by the owner on Sep 16, 2024. It is now read-only.
Heartbeat doesn't work while code is running #8
Open
Description
Platform: (sysname='LoPy', nodename='LoPy', release='1.6.13.b1', version='v1.8.6-607-g9c8a0e9e on 2017-05-01', machine='LoPy with ESP32', lorawan='1.0.0')
Expected behaviour, quoted from documentation:
By default the heartbeat LED flashes in blue color once every 4s to signal that the system is alive.
Observed behaviour:
The heartbeat only flashes when there's no code running!
Steps to reproduce:
os.mkfs('/flash')
, to make sure we're in a completely clean state.- Reset the board.
- Observe that heartbeat LED flashes every 4 seconds.
- Run from the REPL:
while True: pass
- Observe that heartbeat LED doesn't flash anymore.
Alternative ways to reproduce:
Different main.py
files using busy loops, machine idle loops, time sleep loops:
if __name__ == '__main__':
while True:
pass
import machine
if __name__ == '__main__':
while True:
machine.idle()
import utime
if __name__ == '__main__':
while True:
utime.sleep_ms(10)
main.py
file having running code in a separate thread:
import _thread
def foo():
while True:
pass
if __name__ == '__main__':
_thread.start_new_thread(foo, ())
See also the forum thread at the Pycom forums.