搜索了这个但找不到任何东西,所以我怀疑它无法完成。
我需要将参数更新到正在运行的线程:
def doLeds(*leds):
onoff = 0
while 1:
onoff=not onoff
for led in leds:
wpi.digitalWrite(led,onoff)
time.sleep(0.025)
def thread():
from threading import Thread
leds = Thread(target=doLeds, args=([17,22,10,9,11]))
leds.start()
print(leds)
time.sleep(5)
leds['args']=[10,9,11]
线程启动后是否可以更新线程变量/参数?