read battery Status

Hi, i want to run my arduino pro mini with 3.3 V battery and want to read the battery status, so i can replace it when its almost empty. The problem is, there are many differnt versions and i am kind of confused. Can somebody show me a code that works and explain it a bit. I tried for example this code and understood what it does but i get wrong results. Thank you for your help.

int adc_low, adc_high;  
long adc_result; 

long vcc;  
void setup() {    
    

  ADMUX |= (1<<REFS0); 
  ADMUX |= (1<<MUX3) | (1<<MUX2) | (1<<MUX1);  
  delay(10); 
  ADCSRA |= (1<<ADEN);   
}

// the loop routine runs over and over again forever:
void loop() {    
  ADCSRA |= (1<<ADSC);  

  while (bitRead(ADCSRA, ADSC)); 
 
  adc_low = ADCL;
  adc_high = ADCH;

  adc_result = (adc_high<<8) | adc_low; 
  vcc = 1125300L / adc_result;  // (1100mV * 1023 = 1125300)
 
 Serial.println("Battery status");
 Serial.println(vcc);

  delay(500);
}

Sorry, what am I missing? Why not do:

int adc_result; 

float vcc;  

#define BATT_PIN    A0
#define K           0.12345         //whatever conversion works for your setup

void setup() 
{    
    pinMode( BATT_PIN, INPUT );
    
}//setup
    

// the loop routine runs over and over again forever:
void loop() 
{    
    adc_result = analogRead(BATT_PIN);    
    vcc = (float)adc_result * K / 1023.0;
    .
    .
    .
    Serial.println(...
    delay(500);
}

The code in this link uses the internal 1.1v reference voltage to measure the voltage of the battery that is powering the Arduino.

...R