Änderung 2023-05-17
This commit is contained in:
parent
9a20ff2825
commit
96c91a262f
|
@ -1,24 +1,22 @@
|
|||
#include <Arduino.h>
|
||||
|
||||
ADC_MODE(ADC_VCC);
|
||||
|
||||
const float MinimalSpannung = 2.85;
|
||||
float korectur = 1.02910;
|
||||
float korectur = 9.2800899887514060742407199100112e-4;
|
||||
char floatString[15] = {0};
|
||||
float AKKU;
|
||||
|
||||
float getBattery(float kor = 1.000)
|
||||
float getBattery()
|
||||
{
|
||||
#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;
|
||||
int Vcc = ESP.getVcc();
|
||||
float VCC = Vcc * korectur ;
|
||||
Serial.printf("Rohdaten: %d, ", Vcc);
|
||||
dtostrf(VCC,7,2,floatString);
|
||||
Serial.printf("Vcc: %s V\n", floatString);
|
||||
return VCC;
|
||||
}
|
24
include/mess_Ub_old.h
Normal file
24
include/mess_Ub_old.h
Normal file
|
@ -0,0 +1,24 @@
|
|||
#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;
|
||||
}
|
|
@ -25,7 +25,7 @@ lib_deps =
|
|||
|
||||
build_flags =
|
||||
-DTEMPTEST33=1
|
||||
-DNOBATT=1
|
||||
-DNOBATT=0
|
||||
-DMaxErrCount=30
|
||||
-DMQTT=0
|
||||
|
||||
|
|
|
@ -118,7 +118,7 @@ void setup() {
|
|||
//initADS();
|
||||
//init_MCP9808();
|
||||
#endif
|
||||
AKKU = getBattery(korectur); // ca. 170 ms
|
||||
AKKU = getBattery(); // ca. 170 ms
|
||||
// ca. 280 ms
|
||||
if (F_HTU_21D == true){
|
||||
read_HTU21D();
|
||||
|
|
Loading…
Reference in New Issue
Block a user