Wetterstation_Boris/include/mess_Ub_old.h

24 lines
610 B
C
Raw Normal View History

2023-05-18 12:10:48 +02:00
#include <Arduino.h>
const float MinimalSpannung = 2.85;
float korectur = 1.02910;
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 * 3.7; // (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;
}