本站改版新增arduino频道

Micropython
Arduino

micropython esp32 _thread简单用法


_thread

import time, _thread

def some_1(caller, delay):
    print('some_fn called by', caller)
    time.sleep(delay)
    print('some_fn is finished')
    
def some_2(caller, delay):
    print('some_fn called by', caller)
    time.sleep(delay)
    print('some_fn is finished')
    
    
_thread.start_new_thread(some_1, ('main program1', 2))

_thread.start_new_thread(some_2, ('main program2', 2))

print('main program called some_fn & continues')
time.sleep(3)
print('main program still running')



推荐分享
图文皆来源于网络,内容仅做公益性分享,版权归原作者所有,如有侵权请告知删除!
 

Copyright © 2014 ESP56.com All Rights Reserved
晋ICP备14006235号-22 晋公网安备14108102001165号

执行时间: 0.0095610618591309 seconds