battery.h 359 B

12345678910111213141516
  1. #define BATTERY_PIN A6
  2. #if defined BATTERY_ENABLED && BATTERY_ENABLED == 1
  3. void sendBatteryLevel() {
  4. uint16_t batteryLevel;
  5. char buf[64];
  6. // read the battery voltage level
  7. batteryLevel = analogRead(BATTERY_PIN);
  8. // send battery level via serial
  9. sprintf(buf, "%d", batteryLevel);
  10. sendCommand(CMD_SEND_BATTERY, buf);
  11. }
  12. #endif // BATTERY_ENABLED