def FPV_thread(): global fpv fpv = FPV.FPV() fpv.capture_thread(addr[0])
tcpSerSock.bind(ADDR) tcpSerSock.listen(5) #Start server,waiting for client print('waiting for connection...') tcpCliSock, addr = tcpSerSock.accept() print('...connected from :', addr) # fpv=FPV.FPV() # fps_threading=threading.Thread(target=FPV_thread) #Define a thread for FPV and OpenCV # fps_threading.setDaemon(True) #'True' means it is a front thread,it would close when the mainloop() closes # fps_threading.start() #Thread starts break except: led.colorWipe(0,0,0) try: led.colorWipe(0,80,255) except: pass fpv=FPV.FPV() fps_threading=threading.Thread(target=FPV_thread) #Define a thread for FPV and OpenCV fps_threading.setDaemon(True) #'True' means it is a front thread,it would close when the mainloop() closes fps_threading.start() #Thread starts run() try: run() except: servo_move.stop() led.colorWipe(0,0,0) servo.clean_all() move.destroy()
def FPV_thread(): fpv=FPV.FPV() fpv.capture_thread(addr[0])