Any similar function as Arduino's delay() in Linux C program?
Hi, I am writing C program under Linux. Is there a builtin function that allows me to use something like the delay() function in Arduino?
https://www.arduino.cc/reference/en/...ns/time/delay/ |
C is C, pretty much. The OS is immaterial.
|
There is usleep.
Since your program is not alone on a Linux system, you need to be aware that the sleep time is not that accurate: Quote:
|
Quote:
Will keep pulling the time (e.g. date command on linux. not sure about C's function to access it) and checking the difference to see if x msec has passed work better? |
Quote:
Quote:
|
Quote:
|
Realtime priorities allow a process to gain access to the CPU as soon as it wants it, rather than waiting in a run queue.
I can't tell you how to use them, but there should be plenty of information about them on the internet. |
All times are GMT -5. The time now is 09:17 AM. |