I am trying to figure out which reference to use, to be declared with analogReference(type). In fact, without any analogReference declaration (this means default reference=3.3V), I am measuring 300 and something for 2 AA batteries. This would be about 1.1V vs. the reference, then multiplied by 3 for the real battery voltage.
However, I am not able to understand how stable is the default reference if it is provided by the battery. Better a lower one?
Looking here:
https://www.arduino.cc/reference/en/language/functions/analog-io/analogreference/ , it seems there is no INTERNAL1V1 reference on MKR WAN , just AR_INTERNAL1V0, but this would be too low to compare with the 1.1 expected. Thus I am using AR_INTERNAL1V65, and scaling according to it. It is below minimum voltage, so it should be always usable.
(and all of this without considering errors).
By the way, I did not have to include pins_arduino.h (it is already included somewhere in the core).