aymen ammari
aymen ammari
DIIDevHeads IoT Integration Server
Created by aymen ammari on 8/30/2024 in #pcb-and-analog
Incorrect Battery Percentage Reading on MKR 1010 with 3.7V Lithium Battery
Hi I am using the following code to monitor a 3.7V 800MAH lithium battery to power my MKR 1010, and I have all the required library. However, this code always shows the battery percentage as 100, do you have any idea how to solve? #include "Battery.h" Battery battery(2750, 4200, ADC_BATTERY); void setup() { Serial.begin(9600); while (!Serial); analogReference(AR_EXTERNAL); analogReadResolution(10); battery.begin(3300, 1.47); } void loop() { Serial.print("Battery voltage is "); Serial.print(battery.voltage()); Serial.print(" ("); Serial.print(battery.level()); Serial.println("%)"); delay(1000); }
3 replies