I want to use a 5V reference for the ADC (to get 5V = 1023),
and a ~2.5V reference for the analog comparator (< 2.5V = 0, > 2.5V = 1).
Is it possible?
“Configures the reference voltage used for analog input (i.e. the value used as the top of the input range).
Arduino AVR Boards (Uno, Mega, Leonardo, etc.):
INTERNAL2V56: a built-in 2.56V reference”
https://www.arduino.cc/reference/en/language/functions/analog-io/analogreference/