Never dealt with battries so I do not know if it is somehow calculatable.
There got to be a way to calculate precisely how long the bat will effectively operate the MCU to turn on the LED. But I do not know where to begin. Any thought, books, tutorial et ct. ?
The useful life can be calculated easily, but it's
a situation with many variables so the answer
isn't very accurate. A better method is to measure
the useful life over several different batteries and
under worse case conditions, and calculate the
Before starting you'lll need to know about the
battery. In particular, the energy capacity measured
in Ampere-hours at a given load, and the behaviour
of the battery at the end of it's life.
Use Google to find the datasheet for the battery you
will use. Ideally, the battery will give constant voltage
regardless of current demand or temperature, and
when exhausted the voltage will drop suddenly.
A real world battery will gradually decline and do so
faster at elevated temperatures. Also, batteries have
a self-discharge behaviour that will kill the battery if
it is left unused (storage) for a long time. Fresh
batteries are always preferred!
The ampere-hour capacity is known as "C" and the
rate of discharge is often C/5 or C/10, because
a higher current load will shorten the battery run time.
An end-of-life voltage should be selected, and even
if the battery has more energy to give up the load
should be removed when the EOL voltage is reached.
Some rechargeable batteries will be damaged if the
battery is discharged too much.
You can easily rig an experiment with a DMM and
stopwatch (or wall clock) to measure the battery life,
either running the target project or using load resistors
to draw the desired current.