Wetterstation_Boris/include/mess_Ub_old.h
2024-09-28 22:01:53 +02:00

25 lines
647 B
C

#include <Arduino.h>
//const float MinimalSpannung = 2.85;
const float MinimalSpannung = 2.00;
float korectur = 0.8870;
char floatString[15] = {0};
float AKKU;
float getBattery(float kor = 1.000)
{
#if (NOBATT == 1)
Serial.print("Batterie:\t\t 3.05 V\n");
return 3.05;
#endif
float valA0 = analogRead(A0);
valA0 = valA0 * 5.9; // (R1 + r1 + r2) / r2
// r1 und r2 Spannungsteiler
// r1 = 270k, r2 = 100k
// Spannungsbereich = 5.2 Volt
valA0= valA0 / 1024;
valA0 = valA0 * kor;
dtostrf(valA0,7,2,floatString);
Serial.printf("Batterie:\t\t%s V\n", floatString);
return valA0;
}