I have been trying to create a Python program to connect to a serial port and read data from it. There will be a circuit sending the data through the port to PC and the Python program suppose to read and process the data. The data is continuous. The thing I did is something like below:
while (connecting_is_open): [INDENT]read_the_data[/INDENT]
But this will result in an infinite loop as long as the circuit is sending the data. This is when I need user interrupt to break the loop; something like when the above code is running continuously and I want to stop it by user interrupt. How can I do that?