in python code want read data serial port take input user through keyboard.the data serial port , keyboard can come @ time , independent of each other.i started making 2 threads 2 inputs.
import thread def serialread(): while 1: while(is.waiting>0) out+=ser.read() print out # input 'out' def keyboard(): while 1: print(raw_input("enter command")) #now keyboard input thread.start_new_thread(serialread,()) thread.start_new_thread(keyboard, ())
when run above code terminal waits both keyboard input serial read before going next iteration, want when there serial read thread should work , whenever there keyboard inp respective thread should work, should not wait both inputs , got next iteration.
is possible??should use threading module??
Comments
Post a Comment