From 0b00b4d39bda53d8697b9bd8af3dcf19d7bf766d Mon Sep 17 00:00:00 2001 From: Julian Graf Date: Thu, 1 Sep 2022 07:22:06 +0000 Subject: [PATCH] Update 'Teensy4.1_Datalogger new.ino' --- Teensy4.1_Datalogger new.ino | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Teensy4.1_Datalogger new.ino b/Teensy4.1_Datalogger new.ino index 0e4270f..35ae16e 100644 --- a/Teensy4.1_Datalogger new.ino +++ b/Teensy4.1_Datalogger new.ino @@ -196,6 +196,7 @@ private: float wind_summ = 0; int values[60]; int saved_minutes = 0; + int saved_seconds = 0; public: void measure() { @@ -203,11 +204,13 @@ public: wind_sec = map(analogRead(Windfahne), 0, 1023, 20, 350); digitalWrite(power_Windfahne, LOW); wind_summ += wind_sec; + saved_seconds++; } void calculate() { - values[saved_minutes] = wind_summ; + values[saved_minutes] = wind_summ / saved_seconds; wind_summ = 0; saved_minutes++; + saved_seconds = 0; } void file_print() { for (int i = 0; i < saved_minutes; i++) {