better live output

This commit is contained in:
Lukas Heiligenbrunner 2020-04-25 23:39:57 +02:00
parent ffdc4dc101
commit 39e358dd3e

View File

@ -36,10 +36,10 @@ void loop() {
double watt = current * voltage; double watt = current * voltage;
double amphours = current / (3600.0 / INTERVALTIME); // every 10secs is a measurement point... double amphours = current / (3600.0 / INTERVALTIME); // every 10secs is a measurement point...
all += amphours; all += amphours;
Serial.print(all * 1000.0, 5); Serial.print(all * 1000.0, 2);
Serial.print("mA/h already captured after - "); Serial.print("mA/h already captured after - ");
Serial.print(time * INTERVALTIME); Serial.print((time * INTERVALTIME) / 60);
Serial.println("s"); Serial.println("min");
Serial.print("Watts: "); Serial.print("Watts: ");
Serial.println(watt); Serial.println(watt);
@ -49,7 +49,7 @@ void loop() {
} else if (voltage <= MINVOLTAGE) { } else if (voltage <= MINVOLTAGE) {
digitalWrite(MOSFETPIN, LOW); digitalWrite(MOSFETPIN, LOW);
Serial.print("FINISHED voltage below minvoltage - "); Serial.print("FINISHED voltage below minvoltage - ");
Serial.print(all * 1000, 5); Serial.print(all * 1000, 2);
Serial.print("mA/h in - "); Serial.print("mA/h in - ");
Serial.print(time * INTERVALTIME); Serial.print(time * INTERVALTIME);
Serial.println("s"); Serial.println("s");
@ -62,7 +62,6 @@ void loop() {
Serial.println(voltage); Serial.println(voltage);
unsigned int delaytime = (micros() - oldtime) / 1000; unsigned int delaytime = (micros() - oldtime) / 1000;
Serial.println(INTERVALTIME * 1000 - delaytime); delay(INTERVALTIME * 1000 - delaytime); // application loops here for ap. 5 secs
delay(INTERVALTIME * 1000 - delaytime);
oldtime = micros(); oldtime = micros();
} }