Implement how to get the current tick (of the cpu) or create own tick with a defined time interval.
One possibility would be to use a timer interrupt.
solution proposal:
#include <time.h> int main(){ clock_t start, end; int32_t cpu_tick = 0; if(cpu_tick== 0){ start = clock(); for(int i=0; i<100000; i++){ int a = i*2 + i %2323; } end = clock(); cpu_tick = ((int32_t) (end-start)) / F_CPU; } //Our code }
Example calculation for nextTick: clock() + F_CPU * 0.2 The nextTick should then be in 0.2s
clock() + F_CPU * 0.2
No dependencies set.
The note is not visible to the blocked user.
Implement how to get the current tick (of the cpu) or create own tick with a defined time interval.
One possibility would be to use a timer interrupt.
solution proposal:
Example calculation for nextTick:
clock() + F_CPU * 0.2
The nextTick should then be in 0.2s