Detecting the voltage input to the arduino.

You'll need two resistors to make a voltage divider. Then you can use the INTERNAL voltage reference (1.1V) to compare it to so you don't have to compensate for a possibly falling reference voltage.

Step 1 will be bringing the voltage below 1.1V. 10K to Ground and 80K to your battery should divide the voltage by 9.

Step 2 is setting Aref to INTERNAL: analogReference(INTERNAL);

Step 3 is reading the analog input. Read twice and throw out the first one or you'll need smaller resistors.

analogRead(A0);
int voltage = analogRead(A0);

Step 4: Calculate the actual battery voltage. We'll do it in millivolts so we don't have to use floating-point.

unsigned long millivolts = (voltage * 1100UL) / 1024;  // 1100 is the 1.1V reference voltage
milllivolts *= (80+10)/10;  // Undo the voltage divider