In my tkinter program, i plan to have a button to read serial data. This will begin the execution of a function called readSerial() that will grab data and display them to a textbox.
This is the function:
#this function reads the incoming data and inserts them into a text frame
def readSerial():
ser_bytes = ser.readline()
ser_bytes = ser_bytes.decode("utf-8")
text.insert("end", ser_bytes)
if vsb.get()[1]==1.0:
text.see("end")
root.after(100, readSerial)
And we're calling it from a button. Then it starts executing continuously, in intervals - specified in the root.after(100, readSerial)
line
However, my serial device (arduino) will have other modes of operation. So i will also have another button that will command the arduino to stop talking.
Since the arduino will not send any data, i will have to also stop readSerial() from executing.
Is it possible to do so?