My question is, by using the analogReference() function, we are already telling Arduino to use the reference voltage from the default \ AREF. if so, why all of the examples using explicitly the variable 'ref_voltage'?
I know there is no such function.. im asking- why do we tell to Arduino to take external reference voltage and on the same time, give it explicitly- 4.095v
Instead of just take that value from AREF pin
this is not the internal analog reference v's. The author is using the actual maximum measured volts of the input to determine the resolution of the analog reading.
If you choose the option EXTERNAL, then you must connect an external stable supply voltage from 1.1V to 5V at the AREF-pin of the UNO Board (Fig-1).
Figure-1:
To what would the Arduino compare the external reference voltage so it can measure it? The whole point of the external reference is to have something that is independent of how the Arduino is powered. The power can fluctuate and that will influence the result if you would measure the reference voltage. The external reference is (supposed to be) very stable.
The Arduino doesn't know the actual voltage of the INTERNAL (1.1 +/-0.1), EXTERNAL (whatever you connect to AREF), or DEFAULT (whatever is on the Vcc pin) voltage references. It needs that value for the conversion calculation. You have to supply that value to get accurate conversions from analog readings to voltage.
Are you connecting the AREF pin to a 4.096V voltage reference? Then you have to put that value in your sketch.