Skip to content
Advertisement

Tag: sleep

Sleep/block/wait unitil serial data is incoming

I have some live data which is streamed from a microcontroller via serial port to a Raspberry Pi (or for doing prototyping maybe to a PC) with Linux as OS. The data comes roughly every 100 ms. I want to process this data, after receiving (checking of correctness and doing some calculation with some python scripts). However, I didn’t find

In Discord.py, is it possible to wait for a variable to change from a different part of the code than the variable changes?

I tried using time.sleep(), but instead of waiting for the variable it paused the whole code, not allowing the variable to change. This is my code: I can’t figure out what to replace time.sleep(1.0) with. Answer You can use await asyncio.sleep(1) instead. Asyncio.sleep works like time.sleep, but it doesn’t block the entire code execution. It stops only one event. Meanwhile,

Raspbian detect keyboard input while sleeping

I have a python script in Raspbian that loops indefinitely and sleeps for 15 minutes between the main function executions. Main is threaded but usually takes 3 seconds to run. I don’t want any code to interrupt, when in time, the next call is made. During sleep I would like to detect keypress ‘r’ to optionally start another func, possibly

Using Tkinter, Threading and After method

im working on a selenium project using tkinter in python. I want to execute many selenium task at one time(could be up to 100), so I used threading to accomplish this goal, but I came to a problem, due to the fact that I need all individual selenium task to wait a couple seconds between instructions, I used the ‘.after’

Advertisement