1
0

Création d'une fonction wait()

- La fonction wait() permet de mettre en pause le fonctionnement du programme.
This commit is contained in:
Lyanis SOUIDI 2022-12-08 09:54:54 +01:00
parent 0fa6963037
commit 25884773d6
2 changed files with 7 additions and 0 deletions

View File

@ -8,4 +8,6 @@ unsigned long int start_timer(unsigned long int start);
unsigned long int stop_timer(unsigned long int start); unsigned long int stop_timer(unsigned long int start);
void wait(int sec);
#endif #endif

View File

@ -31,3 +31,8 @@ unsigned long int start_timer(unsigned long int start) {
unsigned long int stop_timer(unsigned long int start) { unsigned long int stop_timer(unsigned long int start) {
return Microsecondes() - start; return Microsecondes() - start;
} }
void wait(int sec) {
unsigned long int end = Microsecondes() + (sec * DELTA);
while (Microsecondes() <= end);
}