DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
Keep Light On Using Thread
Copy-paste version
import e32, miso, thread
running = 1
def lighton():
while running:
miso.reset_inactivity_time()
e32.ao_sleep(5)
thread.start_new_thread(lighton, ())
# end by set running = 0
2 functions (lighton, lightoff) version.
import e32
import miso
import thread
flag = 1
def _lighton():
while flag:
miso.reset_inactivity_time()
e32.ao_sleep(5)
def lighton():
thread.start_new_thread(_lighton, ())
def lightoff():
global flag
flag = 0





