From fa639cffc8df8fca093920ce5cb2e3305aafb02d Mon Sep 17 00:00:00 2001 From: Ian Parizot Date: Mon, 25 Nov 2024 17:15:56 +0000 Subject: [PATCH] =?UTF-8?q?Cr=C3=A9ation=20de=20signal.h=20et=20mise=20?= =?UTF-8?q?=C3=A0=20jour=20de=20position.h?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WRO2025/WRO2025_functions/position.h | 7 +++++-- WRO2025/WRO2025_functions/signal.h | 16 ++++++++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 WRO2025/WRO2025_functions/signal.h diff --git a/WRO2025/WRO2025_functions/position.h b/WRO2025/WRO2025_functions/position.h index 6761432..745827e 100644 --- a/WRO2025/WRO2025_functions/position.h +++ b/WRO2025/WRO2025_functions/position.h @@ -1,12 +1,15 @@ #ifndef POSITION_H #define POSITION_H #include +#include "signal.h" + +int a; double time_to_collision_at_rest(float velocity) { clock_t start = clock(); do { - velocity++; - } while (velocity < 1000000); + a = signal(); + } while (a == 1); clock_t end = clock(); double time_to_reception = ((double)(end-start)) / CLOCKS_PER_SEC; return time_to_reception; diff --git a/WRO2025/WRO2025_functions/signal.h b/WRO2025/WRO2025_functions/signal.h new file mode 100644 index 0000000..ecd61fd --- /dev/null +++ b/WRO2025/WRO2025_functions/signal.h @@ -0,0 +1,16 @@ +#ifndef SIGNAL_H +#define SIGNAL_H + +inline int signal() { + int trueornot; + if (trueornot == 0) + { + return 0; + } + else { + return 1; + } + +} + +#endif SIGNAL_H \ No newline at end of file