Design of a proximity Sensor with Digispark MCU
If concerned about battery life, consider not using any COTS micro controller board with an on board analog power regulator:


  On-board 500ma 5V Regulator (MC78M05BDTRKG)


If you must use a regulator, consider a more efficient switching power supply.

Also, to extend the battery life you should use an LCD with no back lighting.

The technique you are using (amount of reflected light?) requires all target surfaces to be identical. Instead, use a parallax infrared IR / LED distance sensor. It will be much easier as there is no calibration. And the distance is in the form of an analog voltage. 

Programming a processor &amp; designing hardware for long battery life operation is not trivial. It requires good hardware design techniques and detailed low level processor knowledge to get down to uA levels.