43 int BATTERY_SENSE_PIN = A0;
45 uint32_t SLEEP_TIME = 900000;
46 int oldBatteryPcnt = 0;
51 #if defined(__AVR_ATmega2560__)
52 analogReference(INTERNAL1V1);
54 analogReference(INTERNAL);
67 int sensorValue = analogRead(BATTERY_SENSE_PIN);
69 Serial.println(sensorValue);
77 int batteryPcnt = sensorValue / 10;
80 float batteryV = sensorValue * 0.003363075;
81 Serial.print(
"Battery Voltage: ");
82 Serial.print(batteryV);
85 Serial.print(
"Battery percent: ");
86 Serial.print(batteryPcnt);
90 if (oldBatteryPcnt != batteryPcnt) {
93 oldBatteryPcnt = batteryPcnt;