I want to create a script that is constantly running in the background, searching for serial inputs. I have the background and serial input parts worked out. All I want to know is an effective way to constantly search for input, that does not bog down my CPU usage, or do I have to use a While loop? I just want to be sure there is a more effective manner of achieving my goal. Thank you!

~Hideyshi

You would indeed use a while loop. You would want the console to be hidden, so save your script as a [*.pyw].
If you want to not use your CPU too much, you could put in a delay/wait/sleep or whatever you want to call it, so the program is checking the serial ports literally all the time. You could have it updating once a second, for example.

Thank you SgtMe! I appreciated your quick reply! I will not use a .pyw as I am running Arch Linux, so I will just execute the script without a console. Thanks again!

OK cheers :)
(Please upvote the helpful post)

commented: Very helpful. +0

OK. Sorry. I'm new here, so.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.