Voltage Divider to Read 9v Battery Voltage and blink led.

You might add some code to calculate the battery voltage.
For vcc = 5V
2.87 V/(5/1024)=2.87/0.0048828125 = 587.776
587.776*0.0048828125 * (9/2.87)=9

analogRead *0.015311955 = battery voltage
Let VanalogRead = 2.87
analogRead = 587.776
battery voltage = 587.776 * 0.015311955 = 8.999999