Jul-24-2017, 01:33 PM
Hi all, interesting problem in Python... I'm working on a project that I will eventually run on a Raspberry Pi, so I'm utilizing Python to manipulate the GPIO. One of the outputs needs to turn on and off at 1 Hz, or every 500 milliseconds. As you may know, there's no native way to get milliseconds in Python, other than to use time.ctime or something along those lines and multiply by 1000, but I'm afraid that may give me a sort of lopsided output in practice. Ideally I'd just like to be able to run time.sleep for 500 milliseconds or something along those lines, but I don't think I can do that either.
Another problem I will need to solve is to find a way to blink this output independent of the rest of my code, as I have several other timed operations and I don't want them to get "paused" while I'm waiting to turn this output on or off. I'm not sure if I need to look into threading, or if again, there's some other more slick way to handle it.
I'd appreciate your thoughts and suggestions! Really hoping I don't have to go back to C++ for this project, because while it does seem to handle timed operations a bit better, it's certainly not as easy to work with.
Another problem I will need to solve is to find a way to blink this output independent of the rest of my code, as I have several other timed operations and I don't want them to get "paused" while I'm waiting to turn this output on or off. I'm not sure if I need to look into threading, or if again, there's some other more slick way to handle it.
I'd appreciate your thoughts and suggestions! Really hoping I don't have to go back to C++ for this project, because while it does seem to handle timed operations a bit better, it's certainly not as easy to work with.
