I'm working on a small project in which I want to monitor the Battery Percentage just like what is display on android phone on top.
The battery consist of Polymer Li-ion Battery with 3 wire (red, black and white).
Can you help me with the code.
Moreover, I'm just a beginner.
If you are lucky the white wire is a OneWire interface to the battery control chip. You will need to install the OneWire library and figure out how to talk to the chip in your battery. The battery control chip keeps track of the number of electrons going into the battery when charging and the number of electrons coming out of the battery in use.
Can you unwrap the battery enough to see the markings on the chip? Use Google to find out what chip has those markings and find the datasheet for that chip.
It sounds like the battery may be a 2S pack, in which case the red and black wires will be pos and neg of the pack and the white wire will be connected to the common connection between the cells and be intended to allow balance charging of the pack.
What is the voltage output of the battery ?
The white wire could also be a thermistor lead, used to measure the battery temperature (common to black).