Avg Voltage
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
uint32_t cRun;
|
||||
int BATTERY_SENSE_PIN = A0;
|
||||
int sensorValue, batteryPcnt;
|
||||
float v, temp_out, hum_out;
|
||||
float v, temp_out, hum_out, v_out;
|
||||
int oldBatteryPcnt = 0;
|
||||
|
||||
void presentation();
|
||||
@@ -75,22 +75,22 @@ void loop() {
|
||||
// send(msgHum.set(hum, 1));
|
||||
}
|
||||
unsigned long battMV = hwCPUVoltage();
|
||||
v = battMV / 1000.0;
|
||||
v_out += (battMV / 1000.0 - v_out) * 0.1;
|
||||
//sensorValue = analogRead(BATTERY_SENSE_PIN);
|
||||
//v = sensorValue * 0.004659498;
|
||||
//batteryPcnt = ((v-3.0) * 100) / 1.2;
|
||||
//sendBatteryLevel(batteryPcnt);
|
||||
if(nRun++ == 3){
|
||||
if(nRun++ == 4){
|
||||
sendData(msgTemp, temp_out, 1);
|
||||
sendData(msgHum, hum_out, 1);
|
||||
sendData(msgVolts, v, 2);
|
||||
sendData(msgVolts, v_out, 2);
|
||||
//send(msgVolts.set(v, 2));
|
||||
//Serial.println(F("Tm run")); Serial.println(millis() - t);
|
||||
sendData(msgMillis, ++cRun * TIME_SLEEP / 60000);
|
||||
nRun = 0;
|
||||
}
|
||||
//send(msgMillis.set(cRun++));
|
||||
sleep((TIME_SLEEP / 4) - (millis() - t));
|
||||
sleep((TIME_SLEEP / 5) - (millis() - t));
|
||||
}
|
||||
|
||||
void presentation()
|
||||
|
||||
Reference in New Issue
Block a user